Skip to main content

sevaht-gui

Small cross-platform GUI building blocks: a system-tray icon and a tkinter application base, shared across Sevaht desktop tools.

Documentation

Full documentation lives in docs/ and is published to GitHub Pages: https://sevaht.github.io/sevaht-gui/.

Building the docs locally

$ uv run --group docs sphinx-build -b html docs docs/_build/html

Then open docs/_build/html/index.html. (Publishing to GitHub Pages requires enabling Pages with the "GitHub Actions" source in the repository settings.)

Tray icon

create_tray_icon returns a single TrayIcon interface backed by the right implementation for the platform:

  • Windows — pystray.
  • Linux — a StatusNotifierItem (D-Bus) item when a usable SNI host is present (KDE/GNOME, Wayland, or fluxbox with snixembed), falling back to a self-contained XEmbed icon on bare X11 window managers with no SNI host.

The feature model is deliberately small: a default activate action (left-click, and the default menu item where a menu is available) and a quit action. Backends that can show a menu (pystray, SNI) offer both on right-click; the menu-less XEmbed backend maps right-click straight to quit.

The icon is any IconSource — a prepared PIL.Image, a path to an image file (both static; the common case), or a renderer Callable[[int], Image] for apps that draw their own artwork. The title (the item's name) and the optional tooltip (the text shown on hover, apart from the title) and the icon can be changed live (set_icon accepts any IconSource), so an app can reflect state either by swapping prepared images or by re-rendering.

macOS is intentionally unsupported: a real menu-bar item there needs a single main-thread Cocoa loop shared with tk (custom PyObjC), which the threaded model used here cannot provide.

Fonts on Linux: use a Python whose Tk has Xft

On X11 (and Wayland through XWayland) Tk draws the system's fonts only if it was built with Xft. Every distribution's Python has that. The Python builds that uv downloads (python-build-standalone) do not: their Tk was built with --disable-xft and can only use the legacy X core fonts, which a modern desktop barely has, so every font falls back to the X server's fixed and the window looks wrong whatever font you ask for. Nothing at run time can change that. TkApp logs a warning when it sees such a Tk; on Windows and macOS this does not apply.

Run on your distribution's Python instead, for example:

uv tool install --python /usr/bin/python3 <your-app>   # or: pipx install <your-app>
uv python pin /usr/bin/python3                          # in a project

or tell uv to only use system interpreters (python-preference = "only-system" in ~/.config/uv/uv.toml). With Xft, TkApp also uses the first installed of Noto Sans, DejaVu Sans, Liberation Sans and Cantarell for Tk's text fonts (font_families=; None keeps Tk's own choice).

TkApp

TkApp owns a tkinter.Tk root and runs its mainloop() on the main thread, running the tray icon's own event loop on a worker thread. Work originating off the UI thread (e.g. tray menu callbacks) is marshalled back with run_on_ui_thread / call_on_ui_thread. show() / hide() and the run(start_hidden=...) flag manage window visibility (all thread-safe), and set_window_icon accepts the same IconSource as the tray.

from sevaht_gui import TkApp, create_tray_icon

app = TkApp()
app.root.title("Example")
app.set_window_icon("icon.png")  # static file; or a PIL image / renderer

icon = create_tray_icon(
    "example",
    "Example",
    "icon.png",          # any IconSource: path, PIL image, or renderer
    on_activate=app.show,
    on_quit=app.stop,
)
app.run(icon, start_hidden=True)  # only the tray shows until activated

The library manages the tray lifecycle, window visibility, and threading; choosing and (re)drawing the artwork is left to the application.

Metadata

Release files for sevaht-gui 1.0.3

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

Source distribution (sdist)

Source distribution for sevaht-gui 1.0.3
File Size Uploaded Provenance Actions
sevaht_gui-1.0.3.tar.gz 31.9 kB With provenance Details for sevaht_gui-1.0.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for sevaht-gui 1.0.3
File Interpreter ABI Platform Actions
sevaht_gui-1.0.3-py3-none-any.whl Python 3 none any Details for sevaht_gui-1.0.3-py3-none-any.whl

Total release size: 64.7 kB

Release files / sevaht_gui-1.0.3.tar.gz

Download URL sevaht_gui-1.0.3.tar.gz
Size 31.9 kB
Tags Source
SHA-256 checksum
How to use checksums
06a6f78fafe5ba99f0fc3d1e409097ee67cf06ef9d0281629c68394ade9da8fd
BLAKE2b-256 checksum
How to use checksums
ba3563eebf4d3422f668a7b21936a203f3edcf99d357fe25df67b11650192fe0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.

Transparency log

Release files / sevaht_gui-1.0.3-py3-none-any.whl

Download URL sevaht_gui-1.0.3-py3-none-any.whl
Size 32.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8b82e6b7e9a4aa899e6582abed111a237b524513d03190afa0db6f976a1790d2
BLAKE2b-256 checksum
How to use checksums
72ac5abe418fba22f19ac98a823b52812cce70ccee491ef2c673f12b7a9072e3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.

Transparency log

Security for sevaht-gui 1.0.3

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for sevaht_gui-1.0.3.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.

Transparency log

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