Skip to main content

wuy

( You should consider GUY (when available)! )

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


html / python

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 !

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.

More on window/server differences

In all cases : it will be pretty easy to produce/freeze an executable (windows/linux/apple) (one file with all html/js embedded), using pyinstaller/windows. And share your super python tool to the world (wuy comes with its own freezer (a wuy app !))! And in the future : android !

Since 0.6; wuy provide a js method to proxify http requests, to avoid CORS troubles.

Since 0.9; wuy provide get/set methods on client/server side to store/retrieve key/value pairs in a json file on serverside.

It's, a little bit, the same thing as python eel.

TODOs:

  • In the future : cefpython3 will be the platform of choice for running wuy apps on android/iphone (when cef and cefpython3 will be ready). Currently wuy works with cefpython3, on linux/windows/apple. It's working in the unittests suite (you can already try ; modify wuy.py, replace ChromeApp() by ChromeAppCef())
  • Write docs & examples

The simplest example

This is the hello world of wuy

import wuy

class helloWorld(wuy.Window):
    """ <button onclick="wuy.beep()">BEEP</button> """
    size=(100,100)

    def beep(self):
        print("\a BEEP !!!")

helloWorld()

To Test/Run

Download the zip from here

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

(winreg is needed for windows only)

It's an app !

For a regular server example (many clients from anywhere on web)

$ python3 -u a_server.py

To Use

Install the lib :

$ pip3 install wuy winreg

(winreg is needed for windows only)

And follow the official tuto.

See Examples

  • an_app : all kind of tricks
  • 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) & FULLSCREEN mode
  • an_app6 : progress bars (async)
  • an_app7 : html is inside the docstring ! (SIMPLEST)
  • an_app8 : just to show how to organize your code when app's expand.
  • an_appVuejs : using a vuejs app (and a continuous push from server to client)
  • a_server : a server, tchat service for multiple clients
  • an_upload : a drag'n'drop upload to server example.

Don't forget to have a look at real examples too (real apps for real life)

A big real life app : See jBrout3 (in development), it's the rebirth of the good old py2/gtk app : jBrout2. It use vuejs/vuex for front, and the jbrout's lib to manage photos.

Doc

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

Use wuy.Server for classic http/ws servers

And client side (javascript), in all cases : use wuy.js

Learn More on differences between this two class

Metadata

Release files for wuy 0.10.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for wuy 0.10.1
File Size Uploaded
wuy-0.10.1.tar.gz 21.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for wuy 0.10.1
File Interpreter ABI Platform
wuy-0.10.1-py3-none-any.whl Python 3 none any Details

Total release size: 71.4 kB

Release files / wuy-0.10.1.tar.gz

Download URL wuy-0.10.1.tar.gz
Size 21.3 kB
Tags Source
SHA-256 checksum
How to use checksums
802c59212c7f78c18b28ea44cabc70d454248851b85ea9cca8fafb59d8e477b5
BLAKE2b-256 checksum
How to use checksums
e87789836f47cf3e3a50fa84e515b23cec0e81c58ed38e19273ec48f39fcb5d9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/0.12.11 CPython/3.7.3 Linux/4.15.0-55-generic

Release files / wuy-0.10.1-py3-none-any.whl

Download URL wuy-0.10.1-py3-none-any.whl
Size 50.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dd3d4ecebefb23ec4b951bd58a8eff3166632ca0240bb78fd3e92a3590ba8493
BLAKE2b-256 checksum
How to use checksums
1da105016cb1e6d7b1758394c4e59fb026697341da14d306808827d02114d2d1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/0.12.11 CPython/3.7.3 Linux/4.15.0-55-generic

Release history Release notifications | RSS feed

This release

0.10.1 This release

2 release files

0.10.0

2 release files

0.9.6

2 release files

0.9.5

2 release files

0.9.4

2 release files

0.9.3

2 release files

0.9.2

2 release files

0.9.0

2 release files

0.8.10

2 release files

0.8.9

2 release files

0.8.8

2 release files

0.8.7

2 release files

0.8.6

2 release files

0.8.5

2 release files

0.8.4

2 release files

0.8.1

2 release files

0.8.0

2 release files

0.7.9

2 release files

0.7.6

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.4

2 release files

0.6.3

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.6

2 release files

0.5.4

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.5

2 release files

0.4.4

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page