Zenity

Last updated
Zenity
Original author(s) Sun Microsystems
Developer(s) Glynn Foster
Lucas Rocha
Stable release
4.0.3 [1]   OOjs UI icon edit-ltr-progressive.svg / 23 October 2024;2 months ago (23 October 2024)
Repository
Operating system Unix-like
License GNU Lesser General Public License
Website gitlab.gnome.org/GNOME/zenity

Zenity is free software and a cross-platform program that allows the execution of GTK dialog boxes in command-line and shell scripts.

Contents

Description

Like tools such as whiptail and dialog, Zenity allows easy creation of GUIs, [2] though it has fewer features than more complex GUI-creation tools. [3]

Other scripting languages such as Perl and Python can be used to construct full-scale GUI applications, but the zenity program enables a shell script to interact with a GUI user.... [The] user interface is not as refined as one that could be provided by a full-featured GUI application, but it is perfectly suitable for simple interactions.

Chris Tyler [4]

Cross-platform compatibility

As of 2012, Zenity is available for Linux, BSD and Windows. [5] A Zenity port to Mac OS X is available in MacPorts and Homebrew.

As of 2018, Zenity ports for Windows are available: zenity-windows (based on version 3.20.0) and 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 for processing. To create 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 in combination with the PyZenity library. [6]

Examples

Python example

A Zenity infobox as displayed on GNOME 3 (Please press a button).png
fromPyZenityimportInfoMessagefromPyZenityimportQuestionfromPyZenityimportErrorMessagechoice=Question('Please press a button.')ifchoice:InfoMessage('You pressed Yes!')else:ErrorMessage('You pressed No!')

POSIX shell script example

#!/bin/shifzenity--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 gotoerror zenity --info --text="You pressed Yes!"gotoend:error zenity --error --text="You pressed No!":end

See also

Related Research Articles

<span class="mw-page-title-main">Xfce</span> Desktop environment

Xfce or XFCE is a free and open-source desktop environment for Linux and other Unix-like operating systems.

In computer programming, standard streams are preconnected input and output communication channels between a computer program and its environment when it begins execution. The three input/output (I/O) connections are called standard input (stdin), standard output (stdout) and standard error (stderr). Originally I/O happened via a physically connected system console, but standard streams abstract this. When a command is executed via an interactive shell, the streams are typically connected to the text terminal on which the shell is running, but can be changed with redirection or a pipeline. More generally, a child process inherits the standard streams of its parent process.

<span class="mw-page-title-main">PyGTK</span> Set of Python wrappers for the GTK graphical user interface library

PyGTK is a set of Python wrappers for the GTK graphical user interface library. PyGTK is free software and licensed under the LGPL. It is analogous to PyQt/PySide and wxPython, the Python wrappers for Qt and wxWidgets, respectively. Its original author is GNOME developer James Henstridge. There are six people in the core development team, with various other people who have submitted patches and bug reports. PyGTK has been selected as the environment of choice for applications running on One Laptop Per Child systems.

<span class="mw-page-title-main">Fox toolkit</span>

The FOX toolkit is an open-source, cross-platform widget toolkit, i.e. a library of basic elements for building a graphical user interface (GUI). FOX stands for Free Objects for X.

The Linux Desktop Testing Project (LDTP) is a testing tool that uses computer assistive technology to automate graphical user interface (GUI) testing. The GUI functionality of an application can be tested in Linux, macOS, Windows, Solaris, FreeBSD, and embedded system environments. The macOS version is named PyATOM, and the Windows version is Cobra. The LDTP is released as free and open-source software under the GNU Lesser General Public License (LGPL).

<span class="mw-page-title-main">GNOME Terminal</span> Terminal emulator from GNOME

GNOME Terminal is a terminal emulator for the GNOME desktop environment written by Havoc Pennington and others. Terminal emulators allow users to access a UNIX shell while remaining on their graphical desktop.

<span class="mw-page-title-main">Tkinter</span> Python binding to the Tk GUI toolkit

Tkinter is a Python binding to the Tk GUI toolkit. It is the standard Python interface to the Tk GUI toolkit, and is Python's de facto standard GUI. Tkinter is included with standard Linux, Microsoft Windows and macOS installs of Python.

WvDial is a utility that helps in making modem-based connections to the Internet that is included in some Linux distributions. WvDial is a Point-to-Point Protocol dialer: it dials a modem and starts pppd in order to connect to the Internet. It uses the wvstreams library.

<span class="mw-page-title-main">Newt (programming library)</span> Software library for user interfaces

Newt is a programming library for color text mode, widget-based user interfaces. Newt can be used to add stacked windows, entry widgets, checkboxes, radio buttons, labels, plain text fields, scrollbars, etc., to text user interfaces. This package also contains the shared library needed by programs built with newt, as well as a CLI application whiptail, which provides the most commonly used features of dialog. Newt is based on the slang library. It abbreviates from Not Erik's Windowing Toolkit.

<span class="mw-page-title-main">Tk (software)</span> GUI toolkit or framework

Tk is a cross-platform widget toolkit that provides a library of basic elements of GUI widgets for building a graphical user interface (GUI) in many programming languages. It is free and open-source software released under a BSD-style software license.

java-gnome is a set of language bindings for the Java programming language for use in the GNOME desktop environment. It is part of the official GNOME language bindings suite and provides a set of libraries allowing developers to write computer programs for GNOME using the Java programming language and the GTK cross-platform widget toolkit.

<span class="mw-page-title-main">GTK</span> Free and open-source cross-platform widget toolkit for creating graphical user interfaces

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 and proprietary software to use it. It is one of the most popular toolkits for the Wayland and X11 windowing systems.

<span class="mw-page-title-main">GNOME</span> Desktop environment for Linux and other Unix-like systems

GNOME originally an acronym for GNU Network Object Model Environment, is a free and open-source desktop environment for Linux and other Unix-like operating systems.

<span class="mw-page-title-main">GNOME Shell</span> Graphical shell of the GNOME desktop environment

GNOME Shell is the graphical shell of the GNOME desktop environment starting with version 3, which was released on April 6, 2011. It provides basic functions like launching applications and switching between windows, and is also a widget engine. GNOME Shell replaced GNOME Panel and some ancillary components of GNOME 2.

<span class="mw-page-title-main">OCRFeeder</span>

OCRFeeder is an optical character recognition suite for GNOME, which also supports virtually any command-line OCR engine, such as CuneiForm, GOCR, Ocrad and Tesseract. It converts paper documents to digital document files and can serve to make them accessible to visually impaired users.

<span class="mw-page-title-main">Cinnamon (desktop environment)</span> Desktop environment

Cinnamon is a free and open-source desktop environment for Linux and other Unix-like operating systems, which was originally based on GNOME 3, but follows traditional desktop metaphor conventions.

<span class="mw-page-title-main">Kivy (framework)</span> Free and multi-platform graphical library for Python

Kivy is a free and open source Python framework for developing mobile apps and other multitouch application software with a natural user interface (NUI). It is distributed under the terms of the MIT License, and can run on Android, iOS, Linux, macOS, and Windows.

References

  1. "4.0.3 · Tags · GNOME / zenity · GitLab". 23 October 2024. Retrieved 10 November 2024.
  2. Cartwright, Ryan (2009-01-30), "More fun with Zenity: shell script/GUI interactivity", Free Software Magazine , archived from the original on 2011-11-06, retrieved 2011-12-10
  3. Diehl, Mike (2008-05-12), "Make Your Scripts User Friendly with Zenity", LinuxJournal, archived from the original on 2011-11-26, retrieved 2011-12-10
  4. Tyler, Chris (2006), "Chapter 4. Basic System Management", Fedora Linux, O'Reilly Media, pp. 258–259, ISBN   978-0-596-52682-5, archived from the original on 2011-07-15, retrieved 2010-03-15
  5. Zenity for Windows, archived from the original on 2012-01-12, retrieved 2011-12-10
  6. Ramos, Brian (2011-04-20), PyZenity, archived from the original on 2013-10-07, retrieved 2012-11-15