13,420
edits
Changes
no edit summary
== Features of Zenity ==
There are many different types of dialog boxes that the Zenity command can create. The following is a table that uses options (starting with -- symbol immediately followed by a word to indicate the type dialog box to creategenerate. You are encouraged to use the online man pages to refer to all options, but here are a couple of options:<br /><br />
<table border="1" cellpadding="10">
</table>
== Don't Make it Complicated ==
Using Zenity is easy- don't make it complicated! For example, think of Zenity as a replacement for the '''echo''' command to display output.You can use '''--info''' to display standard input, and '''--error''' to display standard error messages.
To obtain more options with this command, you should use the man pages... (eg. '''man zenity''').
== Simple Examples ==
<u>Displaying Output</u>
<table>
<tr>
<td>'''zenity --info --text "Here is an example of using zenity command to display text in a dialog box instead instead of using echo to display in a shell..."'''</td>
</tr>
<tr>
<td>Here is output from above command:<br /><br />[[Image:zenity_info.png|left|400px]]</td>
</tr>
</table>
<u>Prompting User for Input</u>
<table>
<tr>
<td>'''zenity --entry --text "Please enter your full name"'''</td>
</tr>
<tr>
<td>Here is input dialog box for user to enter input:<br /><br />[[Image:zenity_entry.png|left|200px]]</td>
</tr>
</table>
<u>Prompting User (Menu Selection)</u>
<table>
<tr>
<td>'''zenity --list --radiolist --text "<b>Please</b> make a selection:" --hide-header --column "Buy" --column "Item" FALSE "Door 1" FALSE "Door 2" FALSE "Door 3" FALSE Quit'''</td>
</tr>
<tr>
<td>Here is input dialog box for user to make a selection from a menu:<br /><br />[[Image:zenity_selection.png|left|300px]]</td>
</tr>
</table>
<u>Piping Command Output to a Graphical Display</u>
<table>
<tr>
<td>'''cal | zenity --text-info'''</td>
</tr>
<tr>
<td>Here is input dialog box to display stdout from a command graphically as opposed to in a shell:<br /><br />[[Image:zenityPipe.png|left|300px]]</td>
</tr>
</table>
<u>Displaying Text Over Several Lines</u>
<table>
<tr>
<td>'''zenity --info --text "Sentence1\n\nSentence2\n\nSentence3"'''</td>
</tr>
<tr>
<td>Here is output from above command. Notice how each sentence appears on a separate line. The "\n" character represents a new-line:<br /><br />[[Image:newlines.png|left|150px]]</td>
</tr>
</table>
Have fun :)