The Living Thing / Notebooks :

UIs in Python

interacting with an app, a python app, without too much dicking about

Stream processing in python, especially, in my case, for UIs.

Modernish evented asynchrony

Modern python async-style stuff.

tl;dr Use the event loop from tornado or pyzmq. These non-thread IO things are very easy and comparatively well-documented. And they work with the new python 3 async style. You can use them to farm off heavy computation to other threaded nightmare hell farms or whatever, and they work now.

Here are some ingredients that might make these work better:

Web toolkits talking to python servers

Thrust renders a chromium window to look at your served code. I’m not 100% clear how it it easier than just running a browser and a server.

brython interprets python using javascript.

GUI toolkits using threads

tkinter

tkinter is well-worn and sturdy dating back to the 90s. It’s a wrapper around the tcl gui toolkit, called tk. If you want to make something simple, it’s not too bad.

It can integrate with tornado.

Beware of the many renames between python 2 and 3.

intros

tips

  • For sorta-native look and feel you use ttk which introduces styles and themes. Neither of these are obvious.
  • Control variables provide convenient data-syncing accessors for what I will loosely call “scalar types”. Think of them as primitive controllers.
  • There are two layout managers, pack and grid. If you come from an HTML background the former is somewhat like a mildly crippled version of block-layout and the latter somewhat more like HTML tables. You can’t mix them within a single parent widget, but you can freely next Frame widgets with different interior layouts.

cefpython

cefpython embeds a chrome webview in python; it also supports bidirectional IPC between python and javascript. Its concurrency constructs look… idiosyncratic.

QT

Want a somewhat more modern look? For QT, use pyotherside.

More hip still, see kivy, a multi-touch and android-friendly complete app environment.

Bizarre crossovers of Web GUIs and user interfaces

DIY python web gui by David Baird:

In this howto, I explain the following concepts:

  1. How to launch a GUI toolkit in a separate thread, and how to communicate with this thread.
  2. How to embed a web browser inside the GUI, and how to communicate with this embedded web browser without using sockets. By not using sockets, we don’t have to worry about socket security, and we don’t have to worry about allocating a socket. […] In other words, we will have AJAX-like […] functionality to communicate with Python but without actually having to use AJAX.