Zenity is
free software
Free software, libre software, libreware sometimes known as freedom-respecting software is computer software distributed open-source license, under terms that allow users to run the software for any purpose as well as to study, change, distribut ...
and a
cross-platform
Within computing, cross-platform software (also called multi-platform software, platform-agnostic software, or platform-independent software) is computer software that is designed to work in several Computing platform, computing platforms. Some ...
program that allows the execution of
GTK
GTK (formerly GIMP ToolKit and GTK+) is a free software cross-platform widget toolkit for creating graphical user interfaces (GUIs). It is licensed under the terms of the GNU Lesser General Public License, allowing both Free software, free and ...
dialog box
In computing, a dialog box (also simply dialog) is a graphical control element in the form of a small window that communicates information to the user and prompts them for a response.
Dialog boxes are classified as " modal" or "modeless", dep ...
es in command-line and
shell script
A shell script is a computer program designed to be run by a Unix shell, a command-line interpreter. The various dialects of shell scripts are considered to be command languages. Typical operations performed by shell scripts include file manipu ...
s.
Description
Like tools such as
whiptail Whiptail can refer to:
* Fish:
** A common name for Blue grenadier, a species of fish in the genus ''Macruronus''
** Whiptail catfish, a common name for the genus of fish ''Rineloricaria''
* A wide variety of long-tailed, New World lizard species f ...
and
dialog, Zenity allows easy creation of GUIs,
though it has fewer features than more complex GUI-creation tools.
Cross-platform compatibility
, Zenity is available for Linux, BSD and Windows.
A Zenity port to Mac OS X is available in
MacPorts
MacPorts, formerly DarwinPorts, is a package manager for macOS and Darwin. It is an open-source software project that aims to simplify the installation of other open source software. It is similar in function to Fink and the BSD ports collection ...
and
Homebrew.
As of 2018, Zenity ports for Windows are available
zenity-windows(based on version 3.20.0) an
winzenity(based on 3.8.0 / statically linked)
Zenity does not possess any built-in scripting capabilities and it must, therefore, rely on an
interpreter
Interpreting is translation from a spoken or signed language into another language, usually in real time to facilitate live communication. It is distinguished from the translation of a written text, which can be more deliberative and make use o ...
for processing. It is found that for the creation of a script that runs on more than one platform without extensive modifications, it would be best to use an interpreter that is available on the widest range of operating systems. One option is
Python
Python may refer to:
Snakes
* Pythonidae, a family of nonvenomous snakes found in Africa, Asia, and Australia
** ''Python'' (genus), a genus of Pythonidae found in Africa and Asia
* Python (mythology), a mythical serpent
Computing
* Python (prog ...
in combination with the PyZenity library.
Examples
Python example
from PyZenity import InfoMessage
from PyZenity import Question
from PyZenity import ErrorMessage
choice = Question("Please press a button.")
if choice:
InfoMessage("You pressed Yes!")
else:
ErrorMessage("You pressed No!")
POSIX shell script example
#!/bin/sh
if zenity --question --text="Please press a button."; then
zenity --info --text="You pressed Yes\!"
else
zenity --error --text="You pressed No\!"
fi
Windows shell script example
@echo off
zenity --question --ok-label="Yes" --cancel-label="No" --text="Please press a button."
if %ERRORLEVEL% 1 goto error
zenity --info --text="You pressed Yes!"
goto end
:error
zenity --error --text="You pressed No!"
:end
See also
*
GTK-server
The GTK-server project aims to bring graphical user interface (GUI) programming to any interpreted language using the GNU Image Manipulation Program (GIMP) ToolKit (GTK) or XForms. It releases free and open-source software under the GNU General Pu ...
*
Dialog
*
List of GNOME applications
The GNOME Core Applications (also known as Apps for GNOME) are a software suite of software applications that are packaged as part of the standard free and open-source GNOME desktop environment. GNOME Core Applications have a consistent look and ...
References
External links
*
GNOME Applications
GNOME Developer Tools
GTK
Sun Microsystems software
{{free-software-stub