Skip to main content

Pywui is a Python package wrapper for pywebview to make easy the communication between python and JS and async support.

Project description

Version Python License

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

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.4.tar.gz (249.5 kB view details)

Uploaded Source

Built Distribution

pywui-0.1.4-py3-none-any.whl (249.1 kB view details)

Uploaded Python 3

File details

Details for the file pywui-0.1.4.tar.gz.

File metadata

  • Download URL: pywui-0.1.4.tar.gz
  • Upload date:
  • Size: 249.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.4 Darwin/23.4.0

File hashes

Hashes for pywui-0.1.4.tar.gz
Algorithm Hash digest
SHA256 eaae077b79848770aa76f19eb1d006314f2a96140075e71de06a351626de4e9c
MD5 1328f57edf30a099092a5e6f96f6df8a
BLAKE2b-256 ad9676e3985f255b602f3d88cb6a8667b4c47f6336322d26ded829bc833f4500

See more details on using hashes here.

File details

Details for the file pywui-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: pywui-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 249.1 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

Hashes for pywui-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 54a7ed653bbe26ebceaede1b8a51ed9284aa762e5edb70ca27b1b23959046b76
MD5 5c112e51bca50ecb39aabf0aff4e0cdc
BLAKE2b-256 0a3504958181493883662f472cadac58ead2ee9aa02cab558ed2025333aef923

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page