Zenity create a text information dialog

by Daniel Pham
Published: Updated:
This entry is part 13 of 13 in the series GUI for bash script using Zenity

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
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:

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
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
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.

(This is an article from my old blog that has been inactive for a long time, I don’t want to throw it away so I will keep it and hope it helps someone).

0 0 votes
Article Rating
Series Navigation«« Previous part: Zenity display text in message dialog

You may also like

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments

DevOps Lite is a personal blog specializing in technology with main topics about DevOps, DevSecOps, SRE and System Administrator. Articles are shared for free and contributed to the community.

SUPPORT US

FOLLOW US

Subscribe my Newsletter for new blog posts. Stay updated from your inbox!

© 2021-2024 DevOpsLite.com – All rights reserved.

Please write sources “DevOpsLite.com” when using articles from this website.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More

2
0
Would love your thoughts, please comment.x
()
x

Adblock Detected

Please support us by disabling your AdBlocker extension from your browsers for our website.