"PUI" Python Declarative UI Framework
Project description
Install
pip install QPUIQ
Example
Code
from PUI import State
# from PUI.tkinter import *
from PUI.PySide6 import *
# from PUI.Qt5 import *
# from PUI.flet import *
data = State()
class Example(Window):
def __init__(self):
super().__init__(title="blah", size=(640,480))
data.var = 50
def content(self):
with VBox():
with Canvas():
CanvasText(data.var, data.var/2, f"blah {data.var}")
CanvasLine(data.var, data.var, data.var*2, data.var*3)
with HBox():
Button("-", self.on_minus)
Label(f"{data.var}")
Button("+", self.on_plus)
def on_minus(self):
data.var -= 1
def on_plus(self):
data.var += 1
root = Example()
root.run()
UI
DOM
Example {
QtVBox {
QtCanvas {
QtCanvasText {
},
QtCanvasLine {
}
},
QtHBox {
QtButton {
},
QtLabel {
},
QtButton {
}
}
}
}
More Example
See examples/*.py
Planned Backends
- tkinter
- PyQt5
- PySide6
- flet
- urwid (Text Mode)
Generic Expression
Elements
- HBox()
- VBox()
- Button(text, callback)
- Label(text)
- TextField(binding)
- ProgressBar(progress
0-1
) - Canvas
- CanvasText
- CanvasLine
Layout
- .layout(weight=1)
- .weight(1)
Hot Reload
Add these lines to your view file and run with reloadium
import reloadium
# reloadium: after_reload
def after_reload(actions):
PUIView.reload()
Progress
- State
Update TriggerBindingStateListStateDict- Lazy UI?
- Passing state to subview
- StateObject decorator
- Adapters
- Split Application/Window, multi-windows
- Navigation Stack
- View Router
LabelButtonTextFieldTimelimeView- Layout
HBoxVBox- ZBox
- Grid
- Row
- Column
- SwiftUI style overlay ??
- Canvas
TextLine- Rect
- Arc
- Image
- ...
- Table
- Tree
- Scrollbar (or as a layout setting)
- Better DOM syncer
- Prevent unnecessary nested update
- Trace Event Source (TextField) and prevent udpate it DOM Sync
- update() -> sync()/inflate()/update() ?
- Pydantic State
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
QPUIQ-0.1.3.tar.gz
(14.0 kB
view details)
File details
Details for the file QPUIQ-0.1.3.tar.gz
.
File metadata
- Download URL: QPUIQ-0.1.3.tar.gz
- Upload date:
- Size: 14.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 01fbfd7f3a411c3a970b627134b93e5559bceef9dabd7be6b9be2242f93612b6 |
|
MD5 | c77b55196f0e33dcb4754409eda40473 |
|
BLAKE2b-256 | 169c6b65c01d0da42562081d6a8ae0a56ebf3da5f6d5c54e13d06fbe627cd62f |