Pywui is a Python package wrapper for pywebview to make easy the communication between python and JS and async support.
Project description
Description
Pywui is a Python package wrapper for pywebview to make easy the communication between python and JS and async support.
Getting started
pip install pywui
Exampple
import asyncio
from datetime import datetime
from pywui import command, PyWuiApp, PyWuiWindow, listener
@listener("message", inject_window=True)
async def on_message(window: PyWuiWindow, message: str):
print("Message received: {}".format(message))
@command(inject_window=True)
async def greet(window: PyWuiWindow):
# window.toggle_fullscreen()
window.emit("message", "Hello from python")
print("Hello :::", window)
return "Hello World!"
async def on_start(window: PyWuiWindow):
async def send_time():
while True:
window.emit("time", datetime.now().strftime("%Y-%m-%d %H:%M:%S"))
await asyncio.sleep(1)
await asyncio.create_task(send_time())
app = PyWuiApp(
"Main Window",
'http://localhost:5174',
confirm_close=False
)
main_window = app.get_main_window()
app.run(func=on_start, args=[main_window], debug=True)
Stay in touch
- Author - Tsiresy Mila
License
PyWui is MIT licensed.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pywui-0.1.3.tar.gz
(249.3 kB
view details)
Built Distribution
pywui-0.1.3-py3-none-any.whl
(248.9 kB
view details)
File details
Details for the file pywui-0.1.3.tar.gz
.
File metadata
- Download URL: pywui-0.1.3.tar.gz
- Upload date:
- Size: 249.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.4 Darwin/23.4.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7f55a8dceb6108903e01a53603259fc9a94aed7a1e58639eaac977a7f9b3ba46 |
|
MD5 | 236fdba8dd6ee92edae2e2d361fb5a31 |
|
BLAKE2b-256 | a2394c551b296c480154b7d62623f3197cca2a67fd3b304da4348169a3e87147 |
File details
Details for the file pywui-0.1.3-py3-none-any.whl
.
File metadata
- Download URL: pywui-0.1.3-py3-none-any.whl
- Upload date:
- Size: 248.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.4 Darwin/23.4.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9cd5e78bad219ecfa5d1c6379cff4798307a51df301b88f510370d7c14327004 |
|
MD5 | dd2fd87ae975915ef25958aa28c32929 |
|
BLAKE2b-256 | d0b6ed866d9b9ae7a1dfb292be2e8552f103d1522e74cf66386e412cb0ce8c94 |