[pygtk] Moving CPU hog into another thread
Mon, 23 Oct 2000 11:54:03 +0200 (CEST)
On Mon, 23 Oct 2000, Aaron Optimizer Digulla wrote:
> I'm looking for an example how to create a stable, multi-threaded
> PyGTK application which has a thread that runs some time-consuming
> process which can update its current status in a status window
> while the user can still use the rest of the app.
You may want to check the Narval Project and the Horn gui (I know, this is
shameless advertising, but he asked for it ;o)
> My problem is mainly how to get the data from one thread to another
> (ie. at a certain time, my time-consuming process has data to display.
> How do I put that data in the GUI ??).
We use a Queue object for communication between the threads. The main
(non-gui) application is Narval, and when it knows a gui (Horn) is
connected, it sends messages in a Queue. The queue is read every 500ms
using a gtk timeout, and depending on what's found in the queue, the gui
LOGILAB, Paris (France).