Creates Graphical Dialog Boxes in Command-line by -ZENITY

by — SANDEEP KUMAR PATEL

GNU Linux, the operating system built on very powerful Kernel called Linux. Linux is famous for its command Line operations. With the invent of Linux in day-to-day and Desktop computing, nix remains no more biased towards command-Line, it is equally Graphical and developing Graphical application remains no more a difficult task.

What is Zenity?

Zenity is an open source and a cross-platform application which displays GTK+ Dialog Boxes in command-line and using shell scripts. It allows to ask and present information to/from shell in Graphical Boxes. The application lets you create Graphical dialog boxes in command-line and makes the interaction between user and shell very easy.

There are other alternatives, but nothing compares to the simplicity of Zenity, specially when you don’t need complex programming. Zenity, a tool you must have your hands on.

Zenity Features

  1. FOSS Software
  2. Cross Platform Application
  3. Allow GTK+ Dialog Box Execution
  4. Command Line Tool
  5. Support in Shell Scripting

Usefulness

  1. Easy GUI Creation
  2. Less features than other complex Tools
  3. Enables shell scripts to interact with a GUI users
  4. Simple dialog creation is possible for graphical user interaction

Since Zenity is available for all known major platforms, and based on GTK+ library, Zenity program can be ported to/from another platform.

Installation of Zenity in Linux

Zentity is by default installed or available in repository of most of the Standard Linux distribution of today. You can check if is installed onto your machine or not by executing following commands.

root@tecmint:~# zenity --calendar
enity --entry --title "Name request" --text "Please enter your name:"

OPTIONS-
This program follows the usual GNU command line syntax, with long options starting

Dialog options

— calendar
Display calendar dialog

— entry
Display text entry dialog

— error
Display error dialog

— file-selection
Display file selection dialog

— notification
Display notification

— progress
Display progress indication dialog

— question
Display question dialog

— text-info
Display text information dialog

— warning
Display warning dialog

— scale
Display scale dialog

— color-selection
Display color selection dialog

— password
Display password dialog

— forms
Display forms dialog

General options

— title=TITLE
Set the dialog title

— window-icon=ICONPATH
Set the window icon with the path to an image. Alternatively, one of the
four stock icons can be used: ‘error’, ‘info’, ‘question’ or ‘warning’

— width=WIDTH
Set the dialog width

— height=HEIGHT
Set the dialog height

— timeout=TIMEOUT
Set the dialog timeout in seconds

Calendar options

— text=STRING
Set the dialog text

— day=INT
Set the calendar day

— month=INT
Set the calendar month

— year=INT
Set the calendar year

— date-format=PATTERN
Set the format for the returned date. The default depends on the user
locale or be set with the strftime style. For example %A %d/%m/%y

Text entry options

— text=STRING
Set the dialog text

— entry-text=STRING
Set the entry text

— hide-text
Hide the entry text

Error options

— text=STRING
Set the dialog text

— no-wrap
Do not enable text wrapping

— no-markup
Do not enable pango markup

File selection options

— filename=FILENAME
Set the file or directory to be selected by default

— multiple
Allow selection of multiple filenames in file selection dialog

— directory
Activate directory-only selection

— separator=SEPARATOR
Specify separator character when returning multiple filenames

— confirm-overwrite
Confirm file selection if filename already exists

— file-filter=NAME | PATTERN1 PATTERN2
Sets a filename filter

Info options

— text=STRING
Set the dialog text

— no-wrap
Do not enable text wrapping

— no-markup
Do not enable pango markup

List options

— text=STRING
Set the dialog text

— column=STRING
Set the column header

— checklist
Use check boxes for first column

— radiolist
Use radio buttons for first column

— separator=STRING
Set output separator character

— multiple
Allow multiple rows to be selected

— editable
Allow changes to text

— print-column=NUMBER
Specify what column to print to standard output. The default is to return
the first column. ‘ALL’ may be used to print all columns.

— hide-column=NUMBER
Hide a specific column

— hide-header
Hides the column headers

Notification options

— text=STRING
Set the notification text

— listen
Listen for commands on stdin. Commands include ‘message’, ‘tooltip’,
‘icon’, and ‘visible’ separated by a colon. For example, ‘message: Hello
world’, ‘visible: false’, or ‘icon: /path/to/icon’. The icon command also
accepts the four stock icon: ‘error’, ‘info’, ‘question’, and ‘warning’

Progress options

— text=STRING
Set the dialog text

— percentage=INT
Set initial percentage

— editable
Allow changes to text

— checkbox=TEXT
Enable a checkbox for use like a ‘I read and accept the terms.’

— ok-label
Set the text of the OK button

— cancel-label
Set the text of the cancel button

Warning options

— text=STRING
Set the dialog text

— no-wrap
Do not enable text wrapping

— no-markup
Do not enable pango markup

Scale options

— text=STRING
Set the dialog text

— value=VALUE
Set initial value

— min-value=VALUE
Set minimum value

— max-value=VALUE
Set maximum value

— step=VALUE
Set step size

— print-partial
Print partial values

— hide-value
Hide value

Color selection options

— color=VALUE
Set the initial color

— show-palette
Show the palette

Password dialog options

— username
Display the username field

Forms dialog options

— add-entry=FIELDNAME
Add a new Entry in forms dialog

— add-password=FIELDNAME
Add a new Password Entry in forms dialog

— add-calendar=FIELDNAME
Add a new Calendar in forms dialog

— text=STRING
Set the dialog text

— separator=STRING
Set output separator character

— forms-date-format=PATTERN
Set the format for the returned date. The default depends on the user
locale or be set with the strftime style. For example %A %d/%m/%y

Thank for your Time….!!!!!!!!

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Sandeep Kumar Patel

Sandeep Kumar Patel

58 Followers

Enthusiastic, aspirant in artificial intelligence, machine learning Research is formalized curiosity. It is poking and prying with a purpose.