Zenity

from Wikipedia, the free encyclopedia
Zenity

Zenity-winXP.png
Simple dialog made with Zenity
Basic data

developer Glynn Foster
Lucas Rocha; ( Sun Microsystems )
Current  version 3.32.0
( March 22, 2019 )
operating system Linux , Solaris , BSD , other Unix derivatives
programming language C.
License LGPL ( Free Software )
live.gnome.org/Zenity

Zenity [ ˈzenətɪ ] is a platform-independent program that allows GTK dialogs to be started from the command line or from shell scripts .

description

Like the similar programs whiptail and dialog, Zenity allows the simple creation of graphical user interfaces (GUIs) . Primarily, simple user dialogs can be generated. The program is not suitable for displaying more complex input masks.

Platform independence

Zenity is tied to the GIMP toolkit . In principle, Zenity can therefore run on all systems supported by GTK ( Linux , BSD , Windows , macOS ). The parameters required to create the dialogs are passed on as command line options. Zenity can therefore be called from Bash , Python (PyZenity), Perl and other programs.

Example: Python script

Zenity question de.png
from PyZenity import InfoMessage
from PyZenity import Question
from PyZenity import ErrorMessage

choice=Question('Bitte einen Button anklicken')

if choice:
    InfoMessage('Ja gedrückt!')
else:
    ErrorMessage('Nein gedrückt!')

Example: Linux bash script

#!/bin/bash

if zenity --question --text="Bitte eine Taste drücken."; then
    zenity --info --text="Ja gedrückt\!"
else
    zenity --error --text="Nein gedrückt\!"
fi

Example: Windows

@echo off
zenity  --question --ok-label="Ja" --cancel-label="Nein" --text="Bitte eine Taste drücken."
if %ERRORLEVEL% == 1 goto error
    zenity --info --text="Ja gedrückt!"
    goto end
:error
    zenity --error --text="Nein gedrückt!"
:end

Alternatives

Individual evidence

  1. gitlab.gnome.org . (accessed on September 22, 2019).
  2. The zenity Open Source Project on Open Hub: Languages Page . In: Open Hub . (accessed October 30, 2018).
  3. ^ Ryan Cartwright: More fun with Zenity: shell script / GUI interactivity . In: Free Software Magazine . 2009 ( online [accessed December 10, 2011]). online ( Memento of the original dated November 6, 2011 in the Internet Archive ) Info: The archive link was inserted automatically and has not yet been checked. Please check the original and archive link according to the instructions and then remove this notice.  @1@ 2Template: Webachiv / IABot / www.freesoftwaremagazine.com
  4. ^ Mike Diehl: Make Your Scripts User Friendly with Zenity . In: LinuxJournal . 2008 ( online [accessed December 10, 2011]).
  5. Chris Tyler: Fedora Linux . O'Reilly Media , 2006, ISBN 0-596-52682-2 , Chapter 4. Basic System Management, pp. 258-259 ( online ).
  6. Zenity for Windows . ( online [accessed December 10, 2011]). online ( Memento of the original from January 12, 2012 in the Internet Archive ) Info: The archive link was inserted automatically and has not yet been checked. Please check the original and archive link according to the instructions and then remove this notice.  @1@ 2Template: Webachiv / IABot / www.placella.com
  7. GTK + Download: Mac OS X . ( online [accessed December 10, 2011]).
  8. Brian Ramos: PyZenity . 2011 ( online [accessed December 10, 2011]). online ( Memento of the original from October 5, 2011 in the Internet Archive ) Info: The archive link was inserted automatically and has not yet been checked. Please check the original and archive link according to the instructions and then remove this notice.  @1@ 2Template: Webachiv / IABot / www.brianramos.com

Web links

Commons : Zenity  - collection of images, videos and audio files