The helper for GUI using PySide6
Project description
uihelper: PySide6 UI helper
This is a set of helpers to improve the development and code readability for PySide6 development. The main focus is on making easier to setup the UI layout and configuration of components. In addition, it provide a iterative 3D plotting library, for quick data visualization.
Installation
Install via pip:
python -m pip install uihelper
Tested on Python 3.12 on Windows 10, Windows 11, MacOS M2, Ubuntu 22.
Install the requirements:
python -m pip install pyside6 pydantic pyopengl pyqtgraph numpy
Additional libraries for styling:
python -m pip install qtmodern
Install from source:
python -m pip install setuptools
python setup.py install
Examples Gallery
Simple Window:
from uihelper import dc
app = dc.Application()
def button1_clicked():
dc.Alert("Alert 2", "Hello World 1!", win)
def button2_clicked():
dc.Alert("Alert 2", "Hello World 2!", win)
win = dc.Widget(
layout=dc.Rows(
dc.Label("UI Helper"),
dc.NextRow,
dc.Button("Button 1", on_click=button1_clicked),
dc.NextRow,
dc.Button("Button 2", on_click=button2_clicked),
dc.NextRow,
dc.TextEdit(placeholder_text="type a text"),
align=dc.Align.Top | dc.Align.Left,
),
window_ops=dc.WindowOps(title="Simple Window", size=(400, 400)),
show=True,
)
app.exec()
MainWindow:
from uihelper import dc
class MyMainWindow(dc.QMainWindow):
def __init__(self) -> None:
super().__init__()
# menu actions
self.action_menu_about = dc.Action(
"About QT", triggered=dc.QApplication.aboutQt
)
self.action_menu_exit = dc.Action(
"&Exit", triggered=self.close, shortcut="CTRL+W"
)
# docks
dock1 = dc.DockWidget(
"Dock Left",
widget=dc.Widget(layout=dc.Rows(dc.Label("Dock 1 - Label"))),
)
dock2 = dc.DockWidget(
title="Dock Bottom",
widget=dc.Widget(layout=dc.Rows(dc.Label("Dock 2 - Label"))),
)
dock3 = dc.DockWidget(
title="Dock Right",
widget=dc.Widget(layout=dc.Rows(dc.Label("Dock 3 - Label"))),
)
# setup main window
dc.MainWindow(
widget=self,
window_ops=dc.WindowOps(
title="MainWindow::UiHelper",
size=(1024, 768),
),
menubar=dc.MenuBar(
dc.Menu(
"&File",
items=[self.action_menu_exit],
),
dc.Menu(
"&View",
items=[
dock1.toggleViewAction(),
dock2.toggleViewAction(),
dock3.toggleViewAction(),
],
),
dc.Menu(
"&Help",
items=[self.action_menu_about],
),
),
statusbar=dc.StatusBar(
dc.Label("Text Status Bar"),
dc.Widget(
layout=dc.Rows(
dc.HSpacer(),
dc.Label("Label"),
align=dc.Align.Right,
),
),
dc.Button("Status Button"),
),
toolbars=[
dc.ToolBar(
"Toolbar",
items=[
dc.Button("button 1"),
dc.Button("button 2"),
dock1.toggleViewAction(),
],
),
],
central_widget=dc.Widget(
layout=dc.Rows(dc.Label("Central Widget"), align=dc.Align.Center),
css="background-color: #000011; color: #cccccc;",
),
docks=[
(dc.Qt.LeftDockWidgetArea, dock1),
(dc.Qt.BottomDockWidgetArea, dock2),
(dc.Qt.RightDockWidgetArea, dock3),
],
show=True,
)
app = dc.Application()
mw = MyMainWindow()
mw.show()
app.exec()
License
This code and repository is provided under MIT License. You are totally free to do what you want with it, just mind that the other libraries (PySide6, PyQtGraph, pydantic, PyOpenGL, qt-modern) have their own licenses.
MIT License
Copyright (c) 2024 Joed Lopes da Silva
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
If you use it for some academic application, you may cite the repository :)
@misc{uihelperjojo,
author = {Joed Lopes da Silva},
title = {uihelper: PySide6 UI library helper},
year = {2024},
howpublished = {\url{https://github.com/joedlopes/uihelper}},
}
Contact me on: x.com/jo_ed
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file uihelper-0.0.2.tar.gz.
File metadata
- Download URL: uihelper-0.0.2.tar.gz
- Upload date:
- Size: 1.5 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d5b772566d18b16eddddaba3bf7f2ed47192d17c8cd5f08a32ce31585ea6fd07
|
|
| MD5 |
e8db5ead08209c22c530941980cb191a
|
|
| BLAKE2b-256 |
cec503d26b5d3c62b7aeb25bb9428ef6f0e8799551f401cb1fae9c197deb2f3d
|
File details
Details for the file uihelper-0.0.2-py3-none-any.whl.
File metadata
- Download URL: uihelper-0.0.2-py3-none-any.whl
- Upload date:
- Size: 1.6 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a02fd87a4358746abb3effced8c4750a0a1d29c1566468ca4e5e31d2b55e7612
|
|
| MD5 |
786dae4c0f0b68dbe23b272aa4f4a746
|
|
| BLAKE2b-256 |
3fe45fcde1f47462cd44300766206f604919decef754757217a6526506153271
|