[pygtk] windows - pygtk - thread - main.iteration problem

Frédéric frederic.mantegazza at gbiloba.org
Sun Jan 11 21:06:55 WST 2009

On dimanche 11 janvier 2009, Thomas Wielatt wrote:

> Hi Everyone
> I've been developing a gui that runs on a separate thread. I prefer to
> update the gui manually by calling main.iteration() in a defined
> interval. This works fine under ubuntu intriped.
> *****************************************
> class Gui (Thread)
> ....
>     def run(self):
>         self.__running = True
>         while self.__running:
>             time.sleep(1.0/self.__action_rate)
>             while gtk.events_pending():
>                 gtk.main_iteration()
> ******************************************

Calling GTK functions in threads is never a good idea... You should move 
your loop in the main thread.

You could also try to call:


before any other GTK call, in the main thread.



More information about the pygtk mailing list