guitools
guitools is a set of utilities for PySide6-based Qt applications, including an extended MainWindow, a message/notification system, styling helpers, and a project template generator.
Installation
pip install guitools
Examples
Most features are exposed directly from the package. Example:
import sys
from PySide6.QtWidgets import (
QApplication,
QWidget,
QVBoxLayout,
QHBoxLayout,
QLabel,
QPushButton,
QTabWidget,
)
from PySide6.QtCore import Qt
from guitools import MainWindow, Styles
from guitools.customWidgets.dockWidget import TabWidgetDock
class DemoWindow(MainWindow):
def __init__(self) -> None:
super().__init__()
self.setWindowTitle("guitools demo")
self.setWindowIcon(Styles.Resources.miniLogo.original())
self._tab_counter = 0
self._docks: list[TabWidgetDock] = []
# Root content container
content = QWidget()
content_layout = QVBoxLayout(content)
content_layout.setContentsMargins(16, 16, 16, 16)
content_layout.setSpacing(12)
self.tabWidget = QTabWidget()
content_layout.addWidget(self.tabWidget, 1)
# Fixed example with exactly 2 tabs.
self.create_tab()
self.create_tab(select_new=True)
# Theme button (bottom-right)
footer = QHBoxLayout()
footer.setContentsMargins(0, 0, 0, 0)
footer.addStretch(1)
self.btn_theme = QPushButton()
self.btn_theme.setMaximumSize(25, 25)
self.btn_theme.setCursor(Qt.CursorShape.PointingHandCursor)
Styles.setIconToggleTheme(self.btn_theme)
self.btn_theme.clicked.connect(self.toggle_theme)
footer.addWidget(self.btn_theme)
content_layout.addLayout(footer)
self.setCentralWidget(content)
self.setStyleSheet(Styles.standard())
def toggle_theme(self) -> None:
Styles.load(Styles.oppositeTheme())
self.setStyleSheet(Styles.standard())
Styles.setIconToggleTheme(self.btn_theme)
def _make_tab_content(self, tab_no: int) -> QWidget:
widget = QWidget()
layout = QVBoxLayout(widget)
layout.setContentsMargins(12, 12, 12, 12)
layout.setSpacing(0)
title = QLabel("GUITools")
title.setAlignment(Qt.AlignmentFlag.AlignCenter)
title.setStyleSheet('font: 600 18pt "Segoe UI";')
layout.addWidget(title, 1)
layout.addStretch(1)
return widget
def create_tab(self, *, select_new: bool = False) -> None:
self._tab_counter += 1
tab_no = self._tab_counter
icon_data = Styles.Resources.Data(
callableIcon=Styles.Resources.miniLogo.original,
hoverCallableIcon=Styles.Resources.miniLogo.original,
)
dock = TabWidgetDock(
tabWidget=self.tabWidget,
widgetCallable=lambda no=tab_no: self._make_tab_content(no),
tabTitle=f"Tab {tab_no}",
docTitle=f"Tab {tab_no}",
iconData=icon_data,
insertPosition=self.tabWidget.count(),
actionEnabled=False,
showLoading=False,
)
self._docks.append(dock)
if select_new:
self.tabWidget.setCurrentWidget(dock.tab)
if __name__ == "__main__":
app = QApplication(sys.argv)
Styles.init("dark") # or "light"
window = DemoWindow()
window.resize(900, 600)
window.show()
sys.exit(app.exec())
Generate a project template (CLI)
The package registers this command:
guitools-create <destination> [--overwrite]
Examples:
guitools-create my-project
guitools-create .
guitools-create my-project --overwrite
guitools-create C:\path\to\my-project
After creation, the template prints the standard next steps shown by the CLI: install dependencies and run python main.py inside the generated directory.
License
Author
Samuel Semedo
Metadata
Release files for guitools 2.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| guitools-2.0.2-py3-none-any.whl | Python 3 | none | any | Details for guitools-2.0.2-py3-none-any.whl |
Release files / guitools-2.0.2-py3-none-any.whl
| Download URL | guitools-2.0.2-py3-none-any.whl |
|---|---|
| Size | 1.5 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1c8d7432d23cead76b57301cb27fc6dbbcfd103fcf939200c47e30f3cbf96b9b
|
|
BLAKE2b-256 checksum How to use checksums |
647a97a2c738cbd5b5d4af979f74106ea46fe487f9126f4716ce39d68b08f524
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.1
|
Security for guitools 2.0.2
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.