Zenity create a text entry dialog

Share this post to your friends !

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

WriteBash - This article will guide you through create a text entry dialog. This dialog is quite simple, the number of support options of the command is not much so this will be short article and quick guide.

Create a text entry dialog

To create a text entry box, use the --entry option in zenity. The default dialog box will display as the image below.

zenity --entry
zenity-create-a-text-entry-dialog-01 Zenity create a text entry dialog
Zenity create default text entry dialog.

The table below show support options for --entry:

Zenity entry options
--text=textSet the text is displayed in the text entry dialog. In the image above, it will replace text “Add a new entry”.
--entry-text=textSet the text is displayed in the entry field of the text entry dialog. Default the entry field is empty.
--hide-textHide the text of the entry field. You can see image below.
zenity --entry --title="WriteBash.com" --text="Demo text for dialog" --hide-text
zenity-create-a-text-entry-dialog-02 Zenity create a text entry dialog
Zenity create text entry dialog with options.

You can try using the --entry-text option to see how it works. Text content as you enter the entry field will returned to the command window. Note that the text entry dialog box can only create a single text field.

Bash script create a text entry dialog

Here is the script to create a text entry dialog, the content of the script is quite simple. You just copy it to your computer or your program is okay.

Read moreCreate a form dialog.

# Script author: Danie Pham
# Script site: https://www.writebash.com
# Script date: 30-01-2018
# Script use to create a text  dialog by using Zenity

# Function create a scale dialog
f_create_entry () {
    if zenity --entry \
        --title="WriteBash.com Text Entry Dialog" \
        --text="Enter your demo text here:" \
        --entry-text "Demo text"
    then echo $?
        else echo "No text entered"

# Main function
f_main () {



This article gives you a quick tutorial on how to create a text entry dialog, which is very simple but will be useful in some cases. Use your imagination to use it to try new things.

Continue reading the series«« Previous part: Zenity create a list dialogNext 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.