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

Uploaded Source

Built Distribution

pywui-0.1.7-py3-none-any.whl (249.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pywui-0.1.7.tar.gz
  • Upload date:
  • Size: 249.8 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.7.tar.gz
Algorithm Hash digest
SHA256 9f08a5404c6e02f589f76b1e486342658cdec5f7cb367a8e5b1055a8e73405fd
MD5 4a6aac4639d66cdfea6945e0ac8c0e2e
BLAKE2b-256 22122b67f8a0a1917abe1205bf66d328627e9d542f08f8ccfd17a67c01ddf68d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pywui-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 249.4 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.7-py3-none-any.whl
Algorithm Hash digest
SHA256 07be9defadcfc6d0370a1e0be32826a061083e9e8d328464b9c1ef9592828078
MD5 435ec71ea00ce228739e5f2a27b60aa3
BLAKE2b-256 acf7e1a70059fcad0489c2db6045ce2d76c5f14d09c4e0cb34c0e699a4f4585c

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