Zenity create a text information dialog

Share this post to your friends !

This entry is part 13 of 13 in the series GUI for bash script using Zenity

WriteBash - In this article, I will introduce the rest of zenity, which is to create a text information dialog. This will help you create dialogs that display information from a text file. Normally, you will see dialog boxes displaying copyright information while installing certain software.

Creates a text information dialog

To create a text information dialog, use the zenity command with the --text-info option:

zenity --text-info

A blank dialog will appear.

zenity-create-a-text-information-dialog-01 Zenity create a text information dialog
Default zenity text info dialog.

If you just use the above then it seems to have no idea what for us. Now we see the other options supported for text-info. Using these new options really helps you do something.

Text info options

The following table lists the support options:

Zenity –text-info options
OptionMeaning
--filename=FILENAMEThe path to the file you want to display its content in the dialog. For example: /home/danie/Desktop/test.txt
--editableAllows you to edit text content when displayed in the dialog box. The edit information will be returned in the command window, not saved to the original text file. You can scale the dialog box using this option. You can try using and do not use this option.
--font=FONTSelect the font to display the text in the dialog box. I rarely use this option.
--checkbox=TEXTActivate the checkbox in the text box as text “I have read and agree to the policies”.
--htmlSupports displaying html code in text file to dialog box.
--url=URLUse url path instead of filename. This option is only available when using --html. I have not tried this option, you can try it.

Below, I will open a text file that I created earlier. In that text file, I write simple content that includes a little html code.

Read moreDisplay text in a message dialog.

I will use the following command to create a text information dialog and display content that does not support html.

zenity --text-info --title="WriteBash.com - demo text-info dialog" --filename=/home/danie/Desktop/test.txt --editable
zenity-create-a-text-information-dialog-02 Zenity create a text information dialog
Create a text information dialog without support html.

Next, I use the command with the html support option, let’s see how the results.

zenity --text-info --title="WriteBash.com - demo text-info dialog" --filename=/home/danie/Desktop/test.txt --editable --html
zenity-create-a-text-information-dialog-03 Zenity create a text information dialog
Create a text information dialog with html support.

The remaining options, please try your own and experience how the results.

Conclusion

With just a few simple lines of code, you can create a text information dialog, in a very simple way. Using your imagination, you can use it in many different situations.

Continue reading the series«« Previous part: Zenity display text in message dialog
If you liked this article, then please subscribe to our YouTube Channel for more video tutorials. You can also find us on Twitter and Facebook.


Share this post to your friends !
If you appreciate what we share in this blog, you can support us by:
  1. Stay connected to: Facebook | Twitter | Google Plus | YouTube
  2. Subscribe email to recieve new posts from us: Sign up now.
  3. Start your own blog with SSD VPS - Free Let's Encrypt SSL ($2.5/month).
  4. Become a Supporter - Make a contribution via PayPal.
  5. Support us by purchasing Ribbon Lite Child theme being using on this website.

We are thankful for your support.

single post bottom banner
«« »»

Got something to say? Join the discussion

Please keep in mind that all comments are subject to our Comment Policy. Your email address will not be published.
This site uses Akismet to reduce spam. Learn how your comment data is processed.