Skip to main content

py-gui-free

A small desktop application framework for Python on Qt (PySide6): an application with a menu bar, a status line, a desktop of numbered windows, dialogs, commands and dockable panels. Python 3.12 or newer, on Windows, Linux and macOS.

It is built the way Borland's application frameworks were (Turbo Vision, ObjectWindows), and it uses the same model as its text-mode sibling py-vision-free: the same command ids, the same menu and status-line data, the same validators. A program written for one reads like a program written for the other.

Install

pip install py-gui-free

The import name is py_gui_free. It installs PySide6 (LGPL) and py-vision-free.

A first program

from py_gui_free import CMD_USER, Application, Command, MenuItem, StatusItem, SubMenu
from py_gui_free import Window, message_box
from PySide6.QtWidgets import QLabel

CM_GREETING = CMD_USER + 1


class Hello(Application):
    title = "Hello"

    def setup(self) -> None:
        self.set_menu_bar([
            SubMenu("~F~ile", [
                MenuItem("~G~reeting...", CM_GREETING, shortcut="Alt-G"),
                MenuItem("-"),
                MenuItem("E~x~it", Command.QUIT, shortcut="Alt-X"),
            ]),
            SubMenu("~W~indow", [
                MenuItem("~T~ile", Command.TILE),
                MenuItem("C~a~scade", Command.CASCADE),
                MenuItem("~N~ext", Command.NEXT, shortcut="F6"),
            ]),
        ])
        self.set_status_line([StatusItem("~Alt-X~ Exit", "Alt+X", Command.QUIT)])
        self.insert_window(Window("Hello", QLabel("Hello, desktop!")), (300, 160))

    def handle_event(self, ev) -> None:
        if ev.command == CM_GREETING:
            message_box(self, "Hello, World!", "Hello")
            ev.clear()


Hello().run()

The pieces

Name What it is
Application the main window: menu bar, tool bar (add_tool), status line, desktop, panels; setup(), handle_event(ev), exec_view(dialog), gui_call(fn)
Desktop, Window numbered windows over QMdiArea: tile, cascade, select_next_window, select_previous_window, zoom, close_current; Window.valid(command)
Dialog named fields (add_field), command buttons (add_buttons), get_data / set_data, valid(command)
message_box, input_box the two everyday dialogs, with the text-mode signatures (default=, input_grace_ms=, max_length; validator= keyword-only)
QtValidator a py-vision-free validator as a QValidator
Panel a widget docked at one side of the main window, shown and hidden by a command
Transcript, Entry, EntryKind a scrolling read-only record of entries (kind, heading, body) with an optional input box; begin(kind, heading) returns an Entry to write into from any thread
gui_call(fn) run fn on the GUI thread soon, from any thread
Document, DocView, DocManager New, Open, Save, Save As and "save changes?"
Command, CMD_USER, SubMenu, MenuItem, StatusItem, OK, OK_CANCEL, YES_NO, the validators shared with py-vision-free: the same objects

Commands are integers. The standard ones are Command.QUIT, Command.TILE, Command.CASCADE, Command.NEXT, Command.PREV, Command.ZOOM, Command.CLOSE, Command.SAVE, ...; an application numbers its own from CMD_USER. A command from a menu item, a status item, a tool button or app.command(id) goes to the active window's handle_event, then to the application's, then to the standard handler. disable_commands([...]) greys every item and button of those commands; enable_state(id) -> (enabled, checked) lets the application answer per command (it is asked at idle and before a menu opens; a checked value makes a menu item a check item).

Labels and keys use the text-mode notation: "~F~ile" marks the hot key, "Alt-X", "Ctrl+S", "Shift-F6" name the keys.

Threads: only the GUI thread may touch widgets. A worker calls gui_call(fn) (or app.gui_call(fn), the same function) and fn runs on the GUI thread on a later turn of the event loop, in call order. Entry.write(text) does this by itself when it is called off the GUI thread; the other Transcript methods (begin, add, note, clear, set_busy) raise RuntimeError there.

Transcript: a record of entries for logs and conversations.

from py_gui_free import EntryKind, Transcript

record = Transcript(prompt=True, on_submit=lambda text: print("sent:", text))
record.note("Ready.")                                   # a one-line remark
record.add(EntryKind.LOCAL, "You", "hello")              # a whole entry
answer = record.begin(EntryKind.REMOTE, "Bot")           # an open entry ...
answer.write("hel").write("lo")                          # ... filled piece by piece
answer.close()
record.set_busy(True)                                    # Send and Ctrl+Enter refused

Text goes in as plain text, never as markup. The view follows new text only while it is scrolled to the bottom. Kinds are LOCAL, REMOTE, SYSTEM and FAULT (or the strings "local", ...); each has its own heading colour.

Examples

python examples/hello.py     # three windows; Window menu: tile, cascade, next, previous, zoom
python examples/dialogs.py   # a form with validators and get_data / set_data
python examples/panels.py    # dock panels, tool bar, checked View items, documents
python examples/mirror.py    # a Transcript fed word by word from a worker thread

Each example takes --shot picture.png to save a picture of its window and exit; with QT_QPA_PLATFORM=offscreen this works without a display.

Publishing (maintainers)

Releases go to PyPI from GitHub Actions with Trusted Publishing (no token): add a pending publisher on PyPI for project py-gui-free, workflow publish.yml, environment pypi; create the environment pypi in the GitHub repository; then push a tag vX.Y.Z equal to the version in pyproject.toml and py_gui_free.__version__.

Metadata

Release files for py-gui-free 1.0.0

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

Source distribution (sdist)

Source distribution for py-gui-free 1.0.0
File Size Uploaded Provenance Actions
py_gui_free-1.0.0.tar.gz 28.3 kB With provenance Details for py_gui_free-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for py-gui-free 1.0.0
File Interpreter ABI Platform Actions
py_gui_free-1.0.0-py3-none-any.whl Python 3 none any Details for py_gui_free-1.0.0-py3-none-any.whl

Total release size: 59.0 kB

Release files / py_gui_free-1.0.0.tar.gz

Download URL py_gui_free-1.0.0.tar.gz
Size 28.3 kB
Tags Source
SHA-256 checksum
How to use checksums
bbcea286b6e984129e4aa03521ac75a3c333d46f02115942d8dfa4f788809e7a
BLAKE2b-256 checksum
How to use checksums
355123679de02f275124fd90413df9d4199bc11e76dd188a05983fea6f383878
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 Nov 29, 2026.

Transparency log

Release files / py_gui_free-1.0.0-py3-none-any.whl

Download URL py_gui_free-1.0.0-py3-none-any.whl
Size 30.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cb8cd5cd37d6140c31bff0e820910a23ee464616e334488d70adb973bf500bc2
BLAKE2b-256 checksum
How to use checksums
f192e365c1cbffbf21e5185cf734e768da61da051a9e969cb0963f9cedb9c623
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 Nov 29, 2026.

Transparency log

Security for py-gui-free 1.0.0

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 py_gui_free-1.0.0.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 Nov 29, 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.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files Full provenance

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