From 5c369a5d98dbab80903dfcb7c52625c78228e789 Mon Sep 17 00:00:00 2001 From: "afix.space" Date: Thu, 9 Jul 2026 19:34:22 +0200 Subject: feat: PySide6 dev environment with runnable examples MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Flake devShell (PySide6 6.11 on Python 3.13, designer, uic/rcc from qtbase libexec, offline docs) plus hello_widgets and hello_quick examples. QML_IMPORT_PATH exported — nixpkgs PySide6 finds platform plugins on its own but not QML imports; see README. --- examples/hello_widgets.py | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 examples/hello_widgets.py (limited to 'examples/hello_widgets.py') diff --git a/examples/hello_widgets.py b/examples/hello_widgets.py new file mode 100644 index 0000000..926fff6 --- /dev/null +++ b/examples/hello_widgets.py @@ -0,0 +1,43 @@ +#!/usr/bin/env python3 +"""Minimal PySide6 Widgets app: a counter demonstrating signals/slots.""" + +import sys + +from PySide6.QtWidgets import ( + QApplication, + QLabel, + QPushButton, + QVBoxLayout, + QWidget, +) + + +def main() -> int: + app = QApplication(sys.argv) + + window = QWidget() + window.setWindowTitle("Hello PySide6") + + label = QLabel("Clics : 0") + button = QPushButton("Cliquer") + + count = 0 + + def on_click() -> None: + nonlocal count + count += 1 + label.setText(f"Clics : {count}") + + button.clicked.connect(on_click) + + layout = QVBoxLayout(window) + layout.addWidget(label) + layout.addWidget(button) + + window.resize(240, 100) + window.show() + return app.exec() + + +if __name__ == "__main__": + sys.exit(main()) -- cgit v1.3.1