Skip to main content

zenity_soso

Python wrapper for zenity.

From the zenity manpage:

zenity is a program that will display GTK+ dialogs, and return (either in the return code, or on standard output) the users input. This allows you to present information, and ask for information from the user, from all manner of shell scripts.

For example, zenity --question will return either 0, 1 or 5, depending on whether the user pressed OK, Cancel or timeout has been reached. zenity --entry will output on standard output what the user typed into the text entry field.

These python wrapper classes accept any of the zenity options as keyword arguments to their constructor. Alternatively, you can set any of the zenity arguments as attibutes of the class. Obviously, attributes and keyword arguments may not contain dashes ("-"), so replace any dashes in the zenity option with an underscore ("_").

After constructing an instance and optionally setting attributes, call the "show()" method and save the return value. "show()" calls the zenity program and usually returns the content of stdout as received from zenity.

The List and Form classes return more than just stdout from the "show()" method. These classes interpret the return value from zenity in order to provide you with a more convenient data structure to work with. See the documentation for details.

After calling "show()", the returncode from zenity is always available as the "returncode" property, and the output of zenity is available as the "stdout" property.

Examples:

Show a message:

from zenity_soso import Info

dlg = Info(text = 'This is the message text', title = 'Some info')
dlg.show()

Ask a question:

from zenity_soso import Question

dlg = Question(text = 'Are you <b>really</b> sure you want to do that?',
    ok_label = 'Sure', cancel_label = 'No, not ever')
if dlg.show():
    print('Okay, you asked for it!')

(The above example illustrates the use of "Pango" markup. See: https://docs.gtk.org/Pango/pango_markup.html)

Choose one out of a list of strings:

from zenity_soso import List

dlg = List(['Tom', 'Dick', 'Harry'])
recipient = dlg.show()
if result:
    print(f'Sending this off to {recipient} ...')

Choose one out of a list of dicts:

from zenity_soso import List
from repr_soso import Repr

dicts = [
	{
		'Name'			: 'Tom',
		'Department'	: 'I.T.',
		'Room'			: 'B11'
	},
	{
		'Name'			: 'Dick',
		'Department'	: 'Sales',
		'Room'			: '9A'
	},
	{
		'Name'			: 'Harry',
		'Department'	: 'Shipping',
		'Room'			: '101'
	}
]
dlg = List(dicts)
result = dlg.show()
Repr(result).print()

The above code prints (when selected):

[
	{
		"Name"		: 'Harry',
		"Department": 'Shipping',
		"Room"		: '101'
	}
]

Pick a color:

from zenity_soso import Color_Selection

dlg = Color_Selection(color = "#00FF00")
result = dlg.show()
if result:
    print(f'Color me {result}')

Limitations

As of this moment, the Progress class is not finished. If you would like to contribute a solution, feel free to make a pull request!

Metadata

Release files for zenity-soso 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for zenity-soso 0.1.1
File Size Uploaded Provenance
zenity_soso-0.1.1.tar.gz 29.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for zenity-soso 0.1.1
File Interpreter ABI Platform
zenity_soso-0.1.1-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 52.7 kB

Release files / zenity_soso-0.1.1.tar.gz

Download URL zenity_soso-0.1.1.tar.gz
Size 29.4 kB
Tags Source
SHA-256 checksum
How to use checksums
c18daf2090e82b02d278e9c2fafa53e6a715b116fd18b245d5c088a64807f6ba
BLAKE2b-256 checksum
How to use checksums
e38b6d6b95681e3bc0e23b132ed22ce684f655986442e8d726c2e8e59c0ae963
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.4

Release files / zenity_soso-0.1.1-py2.py3-none-any.whl

Download URL zenity_soso-0.1.1-py2.py3-none-any.whl
Size 23.3 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
05ab7ac42e2c4ba38903845dcf608596ad9de3f18e258b5d3a02da2b17b282ee
BLAKE2b-256 checksum
How to use checksums
239f9588dafee8e4be779591849f6f88ec10e8e22b38d5eb4a973e03cc2574df
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.4

Security for zenity-soso 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page