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:
terminado provides a terminal for tornado, for quick and dirty interaction.
This feels over-engineered to me, but looks easy.
GUI toolkits using threads
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.
- tkdocs is an incomplete but pretty good book on tkinter, also explaining the perl and ruby versions
- effbot tkinter guide is good and differently incomplete and slightly outdated.
- See Tkinter example for controlling a robot
- NMT Tkinter reference is in-depth but outdated.
- The official tk docs are complete, but referencey and written for tcl rather than python.
- the official python tkinter docs are fine but especially partial.
- 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.
Bizarre crossovers of Web GUIs and user interfaces
In this howto, I explain the following concepts:
- How to launch a GUI toolkit in a separate thread, and how to communicate with this thread.
- 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.