On Sat, 20 Apr 2013 09:10:11 -0700 Kip Warner <k...@thevertigo.com> wrote:
> Hey list, > > I have a separate thread from the main loop that performs some long > and resource intensive operation. The GUI displays an animated GIF > while this process takes place via Gdk.PixbufAnimation. > > Sometimes the animation and the rest of the GUI is very slow to > repaint and respond to other event messages. What is the best way of > giving the message pipeline a breather every now and then from > outside of the main thread? > > I was using GObject.idle_add(self._updateGUI, ...) within the worker > thread to specify a function to be called regularly that could provide > some other GUI related update tasks, including the following within > it... > > # Pump the Gtk+ event handler... > while Gtk.events_pending(): > Gtk.main_iteration() > > However, my application will crash if I do this with a stack overflow > within updateGUI. I'm assuming that since idle_add posted the message > to call the updateGUI callback, when the callback is invoked and > tries to pump the message pipeline, the method is invoked again > because it still hasn't cleared itself from the queue. > > I could have tried this aforementioned event pump from outside the > updateGUI callback and done it from within the worker thread, but I > didn't know if that was thread safe to do. If you have a main loop running, this is completely unnecessary, unless you are doing something to block the loop, which you shouldn't do. Chris _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list