Skip to main content

A simple module for making HTML GUI applications with python3/asyncio

Project description

wuy

If you have made a super python tool, and you want to add a GUI but without using the biggest qt/gtk/tk/wx/kivy : you are in the right place ! Just re-use the local browser (chrome in app mode) as GUI, drived by wuy.

Basically, it's a python module which will act as a web server (http & websocket) and will open/manage a window for you ; providing a simple framework (js/py3 helpers).

It lets you create your GUI with yours web skills (html/js/css or any js frameworks/libs), and re-use the power of python on server side.

Technically, it's a python3 module, using asyncio and the marvellous aiohttp, and (if present) the uvloop, for the full speed ! The http server is here to serve static content (html, js, images ...). The websocket is here to simplify the communication (sync/async) between the window & the server. (rpc method to communicate from client to server, pubsub mechanism to communicate from server to clients, or from client to clients)

In app/window mode : it will manage (open/close) the window for you ; using the chrome app mode ; if the websocket brokes : window & server will shutdown (close the window ; the server will shutdown, close the server ; the window will shutdown). You (or your clients) will not see a difference with classical GUI ! If it can't start a chrome app : it will act as the server mode.

In server mode : it will act as a classical web server ; and you can use as many clients/browsers as you want, from localhost or from anywhere else. Closing a socket ; just close the socket ;-). It can be hosted on the web, as long as the provider service use python3.

In all cases : it will be pretty easy to produce/freeze an executable/windows (one file with all html/js embedded), using pyinstaller/windows. And share your super python tool to the world.

For app/window mode: the wuy/js will work like a charm in chrome. For server mode: you can add polyfill to be able to use a lot of older browsers (IE11, etc ...), see the tchat server.

It's, a little bit, like python eel.

TODOs:

  • Write docs & examples

To Test/Run

Download the zip from here

$ pip3 install aiohttp winreg
$ python3 -u simple.py

(winreg is needed for windows only)

or the new way of doing things, for app/window:

$ python3 -u an_app.py

For the server

$ python3 -u a_server.py

To Use

Install the lib :

$ pip3 install wuy winreg

(winreg is needed for windows only)

See Examples

  • an_app : same as simple.py but in the new fashion
  • an_app2 : an input box
  • an_app3 : an alert box with autodeclared js vars (chain'able windows)!
  • an_app4 : using sync & async rpc calls !
  • an_app5 : using async aiohttp.get (request content from web)
  • an_appVuejs : using a vuejs app (and a continuous push from server to client)
  • a_server : a server, tchat service for multiple clients

with wuy.Window for app (which open/manage a chrome window app)

with wuy.Server for classic http/ws servers

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

wuy-0.5.1.tar.gz (7.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

wuy-0.5.1-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

Details for the file wuy-0.5.1.tar.gz.

File metadata

  • Download URL: wuy-0.5.1.tar.gz
  • Upload date:
  • Size: 7.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for wuy-0.5.1.tar.gz
Algorithm Hash digest
SHA256 ee2463d1545ba8b44fae21b3108ad97e5c470980e5cb3311dd75215b84aa586f
MD5 6428ffcc9974d07f5381261a021fffcd
BLAKE2b-256 30070b1393db097ad079fdefda5e7498453575ac3cf3660a1923a5761bf4f5ab

See more details on using hashes here.

File details

Details for the file wuy-0.5.1-py3-none-any.whl.

File metadata

  • Download URL: wuy-0.5.1-py3-none-any.whl
  • Upload date:
  • Size: 10.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for wuy-0.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 45d75536614530de77d650f377f30899b7d7f96b315fbe20496b3a6e4ae13e2a
MD5 e00fa95f8a82afa733fe2c3a86b6e1d2
BLAKE2b-256 c72c1a9e25ac98802bd43564dcf91bb2e33550354ebbe618d19f2d83a6472e2b

See more details on using hashes here.

Supported by

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