Zenity displays GUI dialogs on linux with examples

Written By Smart| 10 August 2009| 3 Comments

Zenity is a program that allows the execution of GTK+ dialog boxes in command-line and shell scripts.

Zenity manual :

Zenity information dailog box.Using this box you need display information.

For example :

code:

$zenity --info --text "hello World"

           Output :
                 infozenity warning box 

       code:
 $zenity --warning --text "you are running out of disk"    

output :
             warningZenity notification box
      code:
 $zenity --notification --text "You need to update"
        output:
           notificationZenity List box

       code :

         $ zenity --list \
          --title="Choose the greeting to display" \
          --column="number" --column="Timming" --column="Greeting" \
         1 Morning "Good morning" \
         2 Afternoon "Good Afternoon" \
         3 Evening "Good evening" \

output :
     listZenity File selection box

With this you can select a file
     code:
         $zenity --file-selection --title="Browse a File"

Zenity process dialog box
     code
      $(     echo "10" ; sleep 1

 echo "20" ; sleep 1

 echo "50" ; sleep 1

 ) |
 zenity --progress \
 --title="porcess dispaly" \
 --text="processing going..." \
 --percentage=0

output :

            process

 
Related Posts with Thumbnails

Share With Others

3 Comments »

  • Murray Saul said:

    I have created a shell script using Zenity to display an Acceptable Use Policy, (closes box), (Cancel or close box) will logout user…

    … But I was wondering (how|if) you can modify for preset image in dialog box be replaced by a custom image? For example, logo of company enforcing that Acceptable Use Policy?

    Any suggestions would be greatly appreciated…

  • Smart (author) said:

    Hi,

    Yes i can do it .can you send me that script.so that i can go thu it first and revert back to you with solution.

    mail me : admin@smartproteam.com

    Thanx
    admin

  • pedr said:

    Hi,
    First I would like to thank him for about zenity magnificent document, it was very useful to me in my introductory studies.
    Now I’m have one problem and would like to share it with you.

    I create a table, to read the value of one variable, and put on a multiple rows, like your example timming, greeting.
    s1=220
    s1_ex=-100
    s1_resp=”pass”

    zenity –list –multiple –text “result of analyse” –column parametro –column “expected value” –column “measured value” –column “Result” S1_PARAM “$s11_ex” “$s1″ “$s1_resp”

    the scrip above works with positive values(like s1_ex=100), is how to work with negative values for s1?

    Any suggestions would be greatly appreciated…
    thank you so much

Leave your response!




Comment moderation is enabled. Your comment may take some time to appear.