"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()
data.var = 50
class Example(Application):
def content(self):
with Window(title="blah", size=(640,480)):
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(x1, y1, x2, y2, color=0xFF0000, width=2)
Layout
- .layout(width=320, height=240, 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
Use threading.locals() instead of inspect- 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.10.tar.gz
(16.8 kB
view details)
Built Distribution
QPUIQ-0.1.10-py3-none-any.whl
(30.3 kB
view details)
File details
Details for the file QPUIQ-0.1.10.tar.gz
.
File metadata
- Download URL: QPUIQ-0.1.10.tar.gz
- Upload date:
- Size: 16.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 272b57cd060f012665010efb7a52e459ba9ac75b637164d3ff7e7cbb046085dc |
|
MD5 | 1c5cefb23f132ecaa843e4428a566e47 |
|
BLAKE2b-256 | 51cdcab32c9e868e24c65636b70beb2e2f7b480ed3f9b57f348feb759361d6ed |
File details
Details for the file QPUIQ-0.1.10-py3-none-any.whl
.
File metadata
- Download URL: QPUIQ-0.1.10-py3-none-any.whl
- Upload date:
- Size: 30.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1e6ac12ca2d62d0d100407e8f266d49ea910abc8037b80849e77275d8937c9a4 |
|
MD5 | 775781cbdde34591adb20af79b101d4f |
|
BLAKE2b-256 | 90c23acc94e76a3296cd04a7810f6b68c6daf5934f594503f8e38591fbfd7825 |