A complete zenity dialog examples 2

April 22nd, 2007 mysurface Posted in lsof, tee, X11, zenity | Hits: 622363 | 115 Comments »

This is a continues post of A complete zenity dialog examples 1, in this post we will covers zenity dialog for progress, question, warning, scale, text info and list.

How to create zenity progress dialog?
Progress dialog is to track a progression of a routine, it can be anything, let say I want store the results list of open files (lsof) into a file call lsof.txt, and uses zenity progress to track the progression, I do this:

gksudo lsof | tee >(zenity --progress --pulsate) >lsof.txt

zenity progress dialog

I need to use tee, because without using tee, zenity will strip off my result output. Check out tee examples for more information.

How to create zenity question dialog?

zenity --question --text "Are you sure you want to shutdown?"; echo $?

As echo $? returns result 0 means user press yes, 1 means cancel.
zenity question dialog

How to create zenity warning dialog?

zenity --warning --text "This will kill, are you sure?";echo $?

zenity warning dialog

How to create zenity scale dialog?
Scale dialog allows you to set a range of number, so that user are force to pick a number within the range.

ans=$(zenity --scale --text "pick a number" --min-value=2 --max-value=100 --value=2 --step 2);echo $ans

zenity scale dialog

How to create zenity text info dialog?
Text Info can be very useful to display text out to a GUI. I use back the lsof examples, but this time I feed the results to text info box.

gksudo lsof | zenity --text-info --width 530

zenity text info dialog

As you can see, you can specified the width and height of a zenity dialog. Too bad, text info dialog do not have option to disable text wrap and specified what font to use.

How to create zenity list dialog?
List dialog is the most flexible dialog and I have spend quite sometimes to utilize the usage. As it can generate multiple columns, multiple selection, checklist, radiolist etc. checkout –help-list for more information.

This is for radiolist:

ans=$(zenity  --list  --text "Is linux.byexamples.com helpful?" --radiolist  --column "Pick" --column "Opinion" TRUE Amazing FALSE Average FALSE "Difficult to follow" FALSE "Not helpful"); echo $ans

zenity list dialog
First you need to define a columns, then feed all the list options one by one.

This is for checklist:

ans=$(zenity  --list  --text "How linux.byexamples can be improved?" --checklist  --column "Pick" --column "options" TRUE "More pictures" TRUE "More complete post" FALSE "Includes Installation guidelines" FALSE "Create a forum for question queries" --separator=":"); echo $ans

zenity list dialog

The result this time will be long and probably more than one, so you can spefify a separator to differentiate them.

[tags]GUI dialog, GTK+, GUI programming[/tags]

115 Responses to “A complete zenity dialog examples 2”

  1. […] Check out A complete zenity dialog examples 2. Related Posts A complete zenity dialog examples 2This is a continues post of A complete zenity dialog examples 1, in this post we will covers zenity dialog for progress,… using GUI dialog boxEvery GUI program has its command line, even dialog boxes too. zenity for gnome, kdialog for KDE, xmessage for other win… windows user access ssh through puttyPutty is a great ssh client for windows user, it is easy to use and lightweight too. Do you expect to see a tutorial or …                              […]

  2. A/Moniem A/Aal Says:


    This is a very useful information, I was searching the web 2days to get such information. Exellent

  3. Anothr feed track -Linux by Examples…

    One new subscriber from Anothr Alerts…

  4. Nice tutorial guide for on zenity :)
    It’s a nice tutorial..Zenity can also be used to transfer your bash script into gui front-end, for example i used zenity to run my campus local repo on top of https :)
    Check out here http://y0nd13.blogspot.com/2007/04/what-heck.html

  5. Juan Garbanzo Bean Says:

    The example for the progress dialog could be better. Rather than copping out with the –pulsate option, it would’ve been nice to see how you actually get it to track a job.

    Good stuff, otherwise.

  6. To send progress you send percentage numbers. The following is an example (all on one line, of course).

    (for ((i=0;i<100;i+=4)) ; do echo $i ; sleep 1; done) | zenity –progress –auto-close

    In scripts I often create a function and generate the progress values from the function, redirecting the output. Another simple example.

    function pro () {
    read -p “Question 1”
    echo “25”
    read -p “Question 2”
    echo “50”
    read -p “Question 3”
    echo “75”
    read -p “Question 4”
    echo “100”
    pro | zenity –progress –auto-close

    [edited by mysurface]

  7. Hmm… Trimmed my last comment because of the less-than. Let’s try this again!

    (for ((i=0;i<100;i+=4)) ; do echo $i ; sleep 1; done) | zenity –progress –auto-close

  8. Thanks Stacy, very informative. I like the function pro(), make good use of zenity progressing dialog.

  9. […] is here A complete zenity dialog examples 1  & A complete zenity dialog examples 2. 2007-12-31 11:48 by admin, Filed under:Linux   No Comments […]

  10. Thank’s

  11. is there a way to disable the cancel and close button on a dialog

  12. Is there a way to disable the cancel and close buttons in zenity?

  13. Thank you for the example of zenity –list :) Could you please tell me what is the GTK theme you used in the screenshots ?

  14. Is there a way to specify font size? I have a consent paragraph and the display is not completely visible.

  15. @stacy, How about this?

    (for i in $(seq 0 4 100); do echo $i; sleep 1; done)|zenity –progress –auto-close

  16. Couldn’t concur far more with this, really attractive posting. Thank You.

  17. Thank for information. I will back again.

  18. Great ideas. I look forward to reading more of your posts.

  19. Basically to follow up on the update of this topic on your site and would like to let you know how much I appreciated the time you took to write this useful post. In the post, you spoke of how to really handle this issue with all convenience. It would be my pleasure to gather some more ideas from your site and come up to offer others what I have learned from you. I appreciate your usual great effort.

  20. Hi! Thanks! It works, and it was very helpful :)

  21. Is a good idea. I will be told to

  22. I am really impressed with your writing skills and also with the layout on your blog. Is this a paid theme or did you customize it yourself? Anyway keep up the nice quality writing, it is rare to see a great blog like this one nowadays..

  23. some truly nice and useful info on this website , too I conceive the design contains great features.

  24. Thanks for your personal marvelous posting! I definitely enjoyed reading it, you’re a great author.I will be sure to bookmark your blog and will come back later on. I want to encourage one to continue your great posts, have a nice morning!

  25. I´m starting with Zenit now, Your blog is a bible for me now…

  26. The following time I read a blog, I hope that it doesnt disappoint me as much as this one. I mean, I do know it was my option to read, however I truly thought youd have one thing fascinating to say. All I hear is a bunch of whining about something that you can repair when you werent too busy on the lookout for attention.

  27. Thanks for a great take. You really gave us something to think about. Even though there is the global economic crisis, an increasing number of products are being made in China. Therefore, China is becoming a world leader.

  28. My brother suggested I might like this blog. He was totally right. This post truly made my day. You cann’t imagine just how much time I had spent for this Game info! Thanks!

  29. Aw, this was a really nice post. In thought I want to put in writing like this moreover – taking time and precise effort to make an excellent article… however what can I say… I procrastinate alot and certainly not appear to get one thing done.

  30. Debashish Says:


    I am new to zenity. Cud u suggest if its possible to have more than 1 dialogue for a perticular zenity (e.g. I want to create a GUI where the user has to fill his Name n Age). Thanks in adv.

  31. Zenity is simple, what people usually do is call the entry dialog for each question.

  32. I loved as much as you’ll receive carried out right here. The sketch is tasteful, your authored material stylish. nonetheless, you command get bought an impatience over that you wish be delivering the following. unwell unquestionably come further formerly again since exactly the same nearly very often inside case you shield this increase.

  33. #!/usr/bin/perl
    $var=FALSE “abcd” FALSE “defg”;
    now I want to use this $var in any zenity.
    please help………….

  34. Thank you for this valuable information, so nice seeing the community post this kind.

  35. I have problem on zenity –list when using variable

    for example

    DATA=”FALSE Banana \”The fruit that has yellow color\””
    zenity –list –checklist –column “choose” –column “fruit” –column “description” $DATA

    The result is not as I expected
    I want to display

    |choose | fruit | description |
    | [ ] | Banana | The fruit that has yellow color |

    but I got

    |choose | fruit | description |
    | [ ] | Banana | “The |
    | [ ] | that | has |
    | [ ] | color | |

  36. Great post as always appreciate the good read thanks.

  37. I am often to blogging and i really appreciate your content The article has really peaks my interest I am going to bookmark your site and keep checking for new information

  38. Good write-up, I’m regular visitor of one’s website, maintain up the excellent operate, and It is going to be a regular visitor for a long time.

  39. how to display two or more entry field in zenity ???

  40. thanks for the info I’m always here checking out your great site.

  41. Confucius~ Only the wisest and stupidest of men never change.

  42. I like what you guys tend to be up too. This sort of clever work and reporting! Keep up the terrific works guys I’ve included you guys to blogroll.

  43. @awaludin
    I got the same problem. Nobody knows solution?

    OPTIONS=’FALSE “asdfds asdfds” TRUE “asdf asdasd”‘
    $(zenity –height=400 –width=400 –list –text “which?” –radiolist –column “check! ” –column “Choice” $OPTIONS );

    this does not work either…

  44. Is there a way to display a file in zenity and at the same time ask for user input? For example..you cat a file into a info box and at the bottom ask for user input? Or how do you do display a file in an entry box?

  45. […] zenity? I run Fedora, and have successfully used zenity within cron a few times. Have a look here – https://linux.byexamples.com/archives…og-examples-2/ Cheers, […]

  46. This article helped me with a problem I was having with zenity. Thanks!

  47. […] https://linux.byexamples.com/archives/265/a-complete-zenity-dialog-examples-2/ Share this:TwitterFacebookLike this:LikeBe the first to like this […]

  48. Hi there to every one, it’s in fact a good for me to go to see this web page, it includes helpful Information.

  49. […] ??????? ???? ??????????? xrandr’?? ? ???? ????? ? ???? ??????????? zenity (??? ???????????? ???? ?????? ??????????) ? […]

  50. Amazing! Thks!

  51. Edison Bustos Says:

    Very helpful

  52. Hello there! Your post rocks too as getting a reputable superb recognize!??

  53. Thanks to your nice blog. I enjoy your writing.

  54. Having problem putting dialog into PRE login warning. Got the box w/ Close to come up pre login, but ….anyone have examples on how the script should look for the text to show up in the box?



  55. I want to to thank you for this fantastic read!! I
    definitely enjoyed every little bit of it. I have you book-marked to check out new stuff you post…

  56. Sunglasses are all-around for any prolonged time. They’ve always been deemed as items of style and style. Several individuals have often associated sunglasses with appears of sleekness without having any practical purpose. Celebrities have been regarded to make use of sunglasses to help hide their faces from your stares of their fans. In spite of the ignorance of most of the people as to the sensible importance of sunglasses, their reputation has grown steadily. It really is unusual to discover someone without a pair of sunglasses in particular throughout the summertime. People with out their sunglasses on possibly have them stashed away someplace within their closets. Contrary to typical perception nevertheless, sunglasses have numerous health rewards some of which could be viewed beneath.

  57. Khaitan have been proved as top industries in the world for the styles. They have produced fans which consume less energy and also give fresh cool air. Although not all gaming computers cost a fortune, the ones that do are really worth paying for. Gaming computers are not only great for gaming, but they are a great computer over all. space jams for sale http://www.google.fr/webmasters/tools/richsnippets?url=run2013.org/ceshi12.html

  58. The Air Jordan IV took the world by storm in 1989. Along with a career season came a career sneaker. Fatsia can be planted as a large specimen plant, or containerized Fatsia will grow as the shrub as an indoor plant. Philodendron selloum is often used like Fatsia, and can grow into a large, attractive specimen plant on slender, woody-looking trunks (stems). space jams for sale http://www.google.si/webmasters/tools/richsnippets?url=run2013.org/ceshi9.html

  59. Add in the partially ground oats and mix gently to combine. Avoid mashing and over-mixing. Weekender: To Better Remember Latest Highest rated Most watched Most discussed rift requirements Indeed, nothing distinguishes Rift from its competitors quite like its rapid fire content updates. You see, I love the ideas, the polish, and the passion behind Rift, but I’ve never warmed to the game itself. jordan retro 13 http://www.google.tl/webmasters/tools/richsnippets?url=run2013.org/ceshi12.html

  60. A softly outlook Once consumed, the 358 is paradoxically a yielding outlook : the 47 mm of diameter enables a cyclopean dole from the 170 grams of heaviness (that is agreeable to reason regarding how big the horologue, because of the titanium). Enhanced comfort is great, especially if it’s decayed about the left hands since the crown safety doesn’t crowd about the wrist. Just the the third dimension can flinch but tribe get ordinary to it swiftly. The readability is intellectual in each and every locality because of the abstemiousness from the sun-dial and also to the clutches which are generously covered with Super Luminova. Panerai Luminor Watches The flexure bezel is simple to rule. The clicks are unswerving and tight. It exudes solidity. Another strap, ideal for the diving As some chivalrous proprietor will maybe go dabbling some octopuses or sun rays with this particular strict toy, Panerai provides another specifical diving nylon bodily thong on the broach that can take in the lever mainspring from the crown protection. Well musing, it appears of the inexhaustible firmness and enables modifying the dimensions of the strap to every millimeter, that is convenient when putting on diving suite. Inference To cause to approach a conclusion, this scrap doesn’t incompetent arguments. It’ll please both fire-brand fanatics that need to have an exclusive bit, too for the amateurs of outermost diving watches who definitely are lured by its impeccable making.

  61. 886539 530250Write more, thats all I have to say. Literally, it seems as though you relied on the video to make your point. You clearly know what youre talking about, why waste your intelligence on just posting videos to your blog when you could be giving us something enlightening to read? 282132

  62. Usually I do not read article on blogs, but I wish to say that this write-up very forced me to take a
    look at and do it! Your writing taste has been surprised me.

    Thanks, quite nice article.

  63. Thanks for your entire work on this web page. My daughter really likes getting into research and it’s easy to see why.
    Many of us know all of the dynamic manner you deliver informative tactics by means of this blog and in addition strongly encourage contribution from
    others on the area of interest and our favorite simple princess is without question understanding a lot of things.
    Enjoy the remaining portion of the year.
    You are always carrying out a splendid job.

  64. Hiighly energetic article, I enjoyed that a lot.
    Will there be a part 2?

    Also visit my web site: beat roulette; Theo,

  65. Hi, i think that i noticed you visited my website so i came
    tto go back the choose?.I’m trying too to find things to
    improve my weeb site!I suppose its adequate to make use of a few of your ideas!!

  66. I visited several web sites but the audio feature for auudio songs
    pfesent at this web site iss actually fabulous.

  67. Hiya! Quick question that’s completely off topic. Do yyou know howw to make your site mobile friendly?

    My site looks weird when browsing from my iphone4.
    I’m trying to find a template or plugin that might be able to resolve thiis
    problem. If you have any recommendations,
    please share. Thank you!

  68. Learn how to increase the performance and prolong the life of your batteries.
    After you have connected the hoses, turn your engine back on and see if
    that was the cause of the engine vibration noise. The durable components that get re-machined include crankshaft, connecting rods, valves,
    and valve seats.

  69. Wow that was odd. I just wrote an very long comment
    but after I clicked submit my comment didn’t appear.
    Grrrr… well I’m not writing all that over again. Anyway,
    just wanted to say great blog!

    Feel free to surf to my web page :: Madelene F. Ellsbury

  70. you are in point of fact a excellent webmaster.
    The site loading pace is incredible. It seems that you’re doing any unique trick.
    Furthermore, The contents are masterwork.
    you’ve performed a wonderful process in this matter!

  71. Magnificent goods from you, man. I have take note your stuff
    prior to and you are just extremely wonderful.
    I actually like what you have acquired here, certainly like what you’re stating and the way by
    which you are saying it. You’re making it entertaining and you continue to
    take care of to keep it smart. I can’t wait to learn much more from you.

    This is really a great web site.

  72. Appreciation to my father who told me about this blog, this webpage is truly remarkable.

  73. Great blog right here! Additionally your web site lots
    up fast! What host are you using? Can I am getting your
    affiliate link on your host? I want my web site loaded
    up as quickly as yours lol

  74. Is there a way to redirect the close button on the text info dialog to somewhere else instead of closing?

  75. Ok nvm. I already found out how. I just add this if loop directly after my zenity –textinfo command:

    if [ -z ]

    This will bring me back to my main menu when I click close.

  76. ‘zenity –progress’ takes 2 kinds of info on its stdin: percentages that move the progress bar, and text preceded by “# ” that appears above the progress bar. This is not officially documented anywhere! Go ahead, look, I dare you.
    See http://user.cavenet.com/rolandl for timer.txt and ftp-user.txt for examples.

  77. You are so cool! I do not suppose I’ve truly read through a single thing like this before.
    So great to find someone with some genuine thoughts on this subject.
    Seriously.. thanks for starting this up. This site is something that is required on the internet,
    someone with some originality!

  78. […] could use zenity to present the GUI list and gksu to execute the other application. (adsbygoogle = […]

  79. Eric Sebasta Says:

    a select list is not included at all… so this is certainly not a complete list of Zenity examples, although it is far better then most.

    THEUSER=$(zenity –list –title ‘sRestore’ \
    –text \
    “Select user for restore” \
    –column=’USERS:’ $(ls /home)) | cut -f1 -d’|’

    Also, an annoying thing about zenity is a double click will return the answer twice in any select, radio or check list.

    If you only wanted to allow one answer.. like here, you have to pipe your output to that cut command, which rips everything after a pipe, since it separates answers with a pipe character.

  80. […] a simple tutorial with various example about the different dialog available. And there’s also a nice tutorial about […]

  81. I am regular visitor, how are you everybody? This paragraph posted at tnis website is actually good.

  82. People ought to remember, though, that Decatur Capillary Center’s emphyasis iis on venous deficiency,
    not the exclusive ruling out of DVT,” Fortenberry states.

    my web sire … Vein Clinic

  83. Y sont explicites, notamment, les mecanismes d’ouverture et
    de fermeture, les differents poids et leurs consequences sur la maniabilite en voyage, les particularites a considerer du
    matelas afin d’assurer le meilleur sommeil a bebe, le prix et toutes les alternatives complementaires qu’offrent certains lits

  84. Wonderful article! We are linking to this great article on our site.
    Keep up the good writing.

  85. Le direct a meme tendance a virer a l’encyclopedie level instant et il est dur
    de s’y retrouver.

  86. If a canine is being hugged, tugged on, and so on., and begins to emit warning indicators,
    this can be a clear indicator that he/she is now stressed.

    My weblog puppy training nyc

  87. Plus, job seekers will be capable to view your current openings on both your Twitter page or on the JobsonLinkUp Twitter web page.

    my site twitter jobs dc

  88. The website development companies are next in the creation of the site.
    For a landing page to become efficient, it must possess certain characteristics.

    Web application development, content managements system,
    Android applications and responsive website –> the services that we offer.

  89. Many people cannot risk clicking on something like that.
    Imagine how easy it is to supply services to a very densely populated area
    like England and where everyone is literate, in a fixed abode
    and living above the poverty line. Believe it or not, you can generate an amazing amount of traffic using these
    sites and it is fun too.

  90. This is my first time pay a visit at here and i
    am actually pleassant to read everthing at alone place.

  91. It’s remarkable to go to see this website and reading the
    views of all colleagues about this paragraph, while I am also eager of getting familiarity.

  92. Nvidia GeForce GT525 GPU is definitely an extra advantage for individuasls who enjoy playing top end games.
    You will be able to locate a laptop that can be conveniently carrried your financial allowance.

  93. najmisyahiran Says:

    Is it possible for the zenity progress bar to display time remaining or transfer per second (MB/s) for the progress ? For example, by using

    dd if=/dev/zero of=/dev/null status=progress

    If it’s not possible, how can I make it so when the cloning process run, it will show the status=progress log and zenity progress bar at the same time.

  94. Very nice tutorial! Thank you!

  95. Is there some “radio” or check box type of dialog where you can click anywhere in the entire line of the choice to select/mark it, instead of exactly in the box or circle? I hate that.

  96. Eric Sebasta Says:

    The Dude:
    The list method I use allows you to click anywhere on the line.
    His blog fagged up the quotes. Change the weird ass double length hyphen to a double dash for each option, and change the moronic smart quotes to single quotes and try my example:
    THEUSER=$(zenity –list –title ‘User Select’ \
    –text ‘Select user…’ –width
    –column=’USERS:’ $(ls /home) | cut -f1 -d’|’)

  97. Great ideas. I look forward to reading more of your posts.

  98. This is my first time pay a visit at here and i
    am actually pleassant to read everything at alone place.

  99. Wow, lots of spam on this article. Wish I could erase all of it for you.

    Anyway, thanks for the Zenity info!

  100. robot energy


  101. Si te interesa la venta por catalogo, contactame.

  102. El seseo en ell Nuevo Reino de Granada (1550-1650).

  103. Sujeto a la previa aprobación ddel crédito.

  104. Many people prefer gedms with all the rouund cut ffor diamond anniversary bands since
    these are generally capable off producing maximum scintillation. There’s hardl anything else on this plsnet that will produce a girl happier compared to a
    shiny diamond ring. But unfortunately colleftion provided by online jewelry stores
    don’t impress you, try searching the ring on other stores
    that inclufe special discounted offer for tthe
    buying of diamond rings.

  105. Atractive section of content. I just stumbled upon your web sute and in accession capital to assert
    that I acquire in fact enjoyed account your blog posts.

    Anyway I’ll be subscribing iin your augment or
    even I success you get entry to constantly quickly.

  106. 2020 sends it’s thankyous:)

  107. I know this site presents quality based content and other stuff,
    is there any other site which provides such stuff in quality?

Leave a Reply