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_cli

Create new project

    pywui new my_projet

Example

import asyncio
from datetime import datetime

from pywui import command, PyWuiApp, PyWuiWindow, listener, with_window


@with_window
@listener("message", )
async def on_message(window: PyWuiWindow, message: str):
    print("Message received: {}".format(message))


@with_window
@command()
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 = app.get_window("main")
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.6.tar.gz (249.5 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: pywui-0.1.6.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.6.tar.gz
Algorithm Hash digest
SHA256 5e37a53397eacc7fe54b7c1a55cf3baadffdc9bb961a64274e902b9b9210e6b2
MD5 3a1f4be0e0003688896cb12d0cb10243
BLAKE2b-256 df345deb3b8c2bd5b66355dfcffb60408827c11e9e54d7972edfa09cda145f57

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pywui-0.1.6-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.6-py3-none-any.whl
Algorithm Hash digest
SHA256 e2813d78319a570b8ca3ba7f66ce3160e397ef9c2b2725e0fd61729c6c975f30
MD5 f37877ed95908074e33b3a55d791f216
BLAKE2b-256 314eb5b77fa16431ad0d17f10a909692cfcc4052fbb02a01b0ffdf60f90a610c

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