A collection of reusable PySide6 widgets with comprehensive examples and reference implementations. Each widget is presented in Jupyter notebooks with jupytext synchronization for easy exploration and modification.
This project's documentation and code comments were refined with the assistance of Claude Opus 4 (Anthropic) for proofreading, spelling corrections, and clarity improvements. The AI assistant helped ensure consistent code, code formatting, proper grammar, and clear technical writing throughout the codebase.
This project provides well-documented, production-ready PySide6 widgets that can be used as:
- Drop-in components for your applications
- Reference implementations for creating custom widgets
- Learning resources for PySide6 development patterns
- Python 3.8+
- PySide6
- attrs
- loguru
- jupytext (for notebook synchronization)
- jupyter or jupyterlab (for running notebooks)
Install directly from pyproject.toml:
pip install .pyside_references/
├── __init__.py # Project-wide loguru setup
├── widget_utilities.py # Base utilities for import
├── widget_utilities_DevNB.ipynb/.py # Base class demo notebook
└── file_folder_widgets_collection/
└── file_folder_selector_widget_DevNB.ipynb/.py # File/folder selector widget
- Open the
.ipynbfiles in Jupyter to see live examples - Modify and experiment with the widgets interactively
- Use jupytext to keep
.pyand.ipynbfiles synchronized
Import the widgets directly:
from pyside_references import setup_project_logging
from pyside_references.widget_utilities import WidgetUtilities
from pyside_references.file_folder_widget_collection.file_folder_selector_widget import (
FileFolderSelectorQWidget,
FileFolderPathsODM
)
# Setup logging (optional)
setup_project_logging()
# Use the widgets in your application
widget = FileFolderSelectorQWidget()This project uses jupytext to maintain both .py and .ipynb versions of notebooks:
# Sync all notebooks
jupytext --sync **/*.py
# Watch for changes and auto-sync
jupytext --sync **/*.py --pipe-fmt py:percentThis project uses Qt (A C++ Native project)-style naming (e.g., folder_QLineEdit, select_QPushButton) rather than strict Python PEP8. Here's why:
-
Qt Reality: PySide6/PyQt are wrappers around a C++ codebase that already uses its own conventions. Fighting this creates unnecessary friction.
-
Documentation Alignment: When you see
QPushButtonin your code, you can directly search the Qt/PySide docs without mental translation. -
Self-Documenting Code:
folder_QLineEditimmediately tells you: it's for folder input AND it's a QLineEdit widgetQLineEdit_editingFinished_actionclearly shows: it's a slot handling the editingFinished signal from a QLineEditselect_QPushButton_clicked_actionindicates: it handles the clicked signal from select QPushButton
-
Signal/Slot Clarity: Slot naming follows the pattern
[widget]_[signal]_action, making signal-slot connections self-documenting. When debugging, you instantly know which widget and signal triggered a slot. -
PEP8 Wisdom: PEP8 itself states: "A foolish consistency is the hobgoblin of little minds" and explicitly encourages breaking conventions when it improves readability.
The goal is practical, maintainable code that works well with the Qt ecosystem, not style guide purity.
-
FileFolderSelectorQWidget - A unified file and folder selection widget with:
- Synchronized path management via attrs-based ODM
- Both text entry and dialog-based selection
- Automatic path validation and normalization
-
WidgetUtilities - Base class providing:
- Standard GUI initialization pattern
- Debug utilities for widget inspection
- Future pyautogui automation support
- Matplotlib integration widgets
- Pandas DataFrame viewers and editors
- Plot configuration widgets
- Data transformation widgets
This is a personal reference collection, but suggestions and improvements are welcome. The focus is on practical, working code that serves as good examples for real-world usage.
[Your chosen license]
- The
capture_widget_info()method in WidgetUtilities is designed for future pyautogui automation - All widgets follow a consistent initialization pattern for easy customization
- Validators in ODM classes are intentionally commented out for easy subclassing