what is the best practice to separate Pygtk and long running thread code

Thomas Guettler niemand.leermann at thomas-guettler.de
Fri Sep 22 09:13:52 EDT 2006


seb wrote:

> Hi,
>
> I am using pygtk for the first times.
>
> I am wondering what would be the best "pattern" to interface pygtk with
> a thread.
>
> The thread is collecting informations (over the network for example) or
> is doing some long calculations.

Hi,

I would use several *processes*. If your scripts runs on Unix/Linux
you can use select() on the filedescriptors of the processes you created
with popen. On Windows you need to poll them, but maybe this is
better than threads, too. With idle_add you can get data from
the subproceses. It gets called if there are no actions in the
event-loop.

HTH,
 Thomas

-- 
Thomas Güttler, http://www.thomas-guettler.de/ http://www.tbz-pariv.de/
E-Mail: guettli (*) thomas-guettler + de
Spam Catcher: niemand.leermann at thomas-guettler.de




More information about the Python-list mailing list