Skip to main content

Reusable PySide6 GUI components

Project description

pyside6-widgets

Reusable PySide6 GUI components for scientific applications.

Built from real scientific software, these widgets are production-tested and designed to be dropped into any PySide6 project with no external dependencies beyond PySide6 itself (plus Matplotlib for the SVG label).

Components

Widget / Module Description
MathLabel SVG-backed label with optional LaTeX rendering via Matplotlib
NumericLineEdit Validated numeric input with scientific notation and range checking
SciNumberValidator Qt validator for integer and float input
MenuBarController Build a full Qt menu bar from a Python dict — no boilerplate
StatusBarController State-aware status bar with live memory and elapsed-time display
dialogs General-purpose message, info, about, and confirmation dialogs

Installation

pip install pyside6-widgets

Quick Start

MathLabel

Renders math expressions using Matplotlib's mathtext engine. Pass use_tex=True only if a LaTeX distribution is installed on the system.

from pyside6_widgets import MathLabel

# Matplotlib mathtext (no LaTeX installation needed)
label = MathLabel(text=r"E=mc^2", font_size=20, text_color="black")

# Full LaTeX rendering (requires LaTeX installation)
label = MathLabel(text=r"E=mc^2", font_size=20, use_tex=True)

NumericLineEdit

from pyside6_widgets import NumericLineEdit

# Float input in range [0, 100]
edit = NumericLineEdit(init_val=1.5, min_limit=0.0, max_limit=100.0, val_fmt="{:.3g}")
edit.valueChanged.connect(lambda v: print(f"New value: {v}"))

# Integer input
edit = NumericLineEdit(init_val=10, value_is_int=True, min_limit=0, max_limit=999)

MenuBarController

from PySide6.QtWidgets import QMainWindow
from pyside6_widgets import MenuBarController

class MyWindow(QMainWindow):
    def __init__(self):
        super().__init__()
        menu_spec = {
            "File": [
                {"id": "open", "text": "Open…", "shortcut": "Ctrl+O"},
                {"id": "sep"},
                {"id": "quit", "text": "Quit", "shortcut": "Ctrl+Q"},
            ],
            "View": [
                {"id": "dark_mode", "text": "Dark Mode", "checkable": True},
            ],
        }
        self.menu = MenuBarController(self, menu_spec=menu_spec)
        self.menu.actionTriggered.connect(self.on_action)

    def on_action(self, menu: str, action_id: str, checked: bool):
        print(f"{menu}{action_id} (checked={checked})")

StatusBarController

from PySide6.QtWidgets import QMainWindow
from pyside6_widgets import StatusBarController, StatusState

class MyWindow(QMainWindow):
    def __init__(self):
        super().__init__()
        self.status = StatusBarController(self)

    def run_solver(self):
        self.status.set_state(StatusState.SOLVING)   # starts timer
        # ... do work ...
        self.status.set_state(StatusState.READY)     # stops timer

Dialogs

from pyside6_widgets import (
    show_information, show_warning, show_critical,
    show_about_dialog, ask_question, AskResult,
)

# Simple message dialogs
show_information("Done", "The export completed successfully.")
show_warning("Warning", "File already exists.")
show_critical("Error", "Could not open file.")

# About dialog
show_about_dialog(
    title="My App",
    html_text="<p>Version 1.0</p><p>Author: Vahid Anari</p>",
    heading="My App",
)

# Confirmation dialog
result = ask_question("Confirm", "Are you sure you want to delete this?")
if result == AskResult.YES:
    delete()

Requirements

  • Python 3.10+
  • PySide6 >= 6.5
  • matplotlib >= 3.7 (required only for SvgLabel)
  • psutil >= 5.9 (required only for StatusBarController)

License

MIT License — see LICENSE for details.

Author

Vahid Anari — GitHub · LinkedIn

Reusable PySide6 GUI components — validated numeric inputs, math labels, declarative menu bar, status bar, and dialogs.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyside6_widgets-0.1.0.tar.gz (26.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyside6_widgets-0.1.0-py3-none-any.whl (28.3 kB view details)

Uploaded Python 3

File details

Details for the file pyside6_widgets-0.1.0.tar.gz.

File metadata

  • Download URL: pyside6_widgets-0.1.0.tar.gz
  • Upload date:
  • Size: 26.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for pyside6_widgets-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e66ef88b6363647c562e649efd0527e81144dd7c06227994fb08062794890954
MD5 651c2e52fd2987783726fc514b5557bc
BLAKE2b-256 734fd28af4dca7dc5b27f524908f660c9906297948411e6e4cd5b801cc1b74ae

See more details on using hashes here.

File details

Details for the file pyside6_widgets-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pyside6_widgets-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5ca0894454c7e76316848d29ce646c30821b94e4970b97aa4652d0abebe8bdb6
MD5 4b809c3a9f333716aae422ac058bb817
BLAKE2b-256 737b8ad3ac670bf4691e16365dc3fae7917a44224349c5d20f765ff7ed6a05aa

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page