Zenity
| Zenity
| |
|---|---|
Einfacher Dialog erstellt mit Zenity | |
| Basisdaten
| |
| Entwickler | Glynn Foster Lucas Rocha; (Sun Microsystems) |
| Aktuelle Version | 4.2.1[1] (7. November 2025) |
| Betriebssystem | Linux, Solaris, BSD, andere Unix-Derivate |
| Programmiersprache | C[2] |
| Lizenz | LGPL (Freie Software) |
| live.gnome.org/Zenity | |
Zenity [] ist ein plattformunabhängiges Programm, das es erlaubt, GTK-Dialoge von der Kommandozeile oder von Shellskripten aus zu starten.
Beschreibung
Zenity erlaubt, wie auch die ähnlichen Programme whiptail und dialog die einfache Erstellung von grafischen Benutzeroberflächen (GUIs).[3] Primär können einfache Benutzerdialoge erzeugt werden. Zur Darstellung komplexerer Eingabemasken ist das Programm nicht geeignet.[4][5]
Plattformunabhängigkeit
Zenity ist an das GIMP-Toolkit gebunden. Im Prinzip ist Zenity daher auf allen von GTK unterstützten Systemen lauffähig (Linux, BSD, Windows,[6] macOS[7]). Die zur Erstellung der Dialoge notwendigen Parameter werden als Kommandozeilenoptionen weitergegeben. Zenity kann daher von Bash, Python (PyZenity), Perl und anderen Programmen aufgerufen werden.[8]
Beispiele
Python-Skript

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!')
Bash-Skript
#!/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
Windows-Shell-Skript
@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
Alternativen
Einzelnachweise
- ↑ gitlab.gnome.org.
- ↑ The zenity Open Source Project on Open Hub: Languages Page. In: Open Hub. (abgerufen am 30. Oktober 2018).
- ↑ Ryan Cartwright: More fun with Zenity: shell script/GUI interactivity. In: Free Software Magazine. 2009 (online [abgerufen am 10. Dezember 2011]).
- ↑ Mike Diehl: Make Your Scripts User Friendly with Zenity. In: LinuxJournal. 2008 (online [abgerufen am 10. Dezember 2011]).
- ↑ Chris Tyler: Fedora Linux. O’Reilly Media, 2006, ISBN 0-596-52682-2, Chapter 4. Basic System Management, S. 258–259 (online).
- ↑ Zenity for Windows. (online [abgerufen am 10. Dezember 2011]).
- ↑ GTK+ Download: Mac OS X. (online [abgerufen am 10. Dezember 2011]).
- ↑ Brian Ramos: PyZenity. 2011 (online [abgerufen am 10. Dezember 2011]).
Weblinks
- Zenity-Handbuch (deutsch)
- Zenity examples ( vom 13. Februar 2015 im Internet Archive) (englisch)
Content Disclaimer
Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.
- The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
- There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
- It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
- Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
- Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.