Hi Kip, On 13 June 2013 06:40, Kip Warner <k...@thevertigo.com> wrote: > If I start the long job function from within my assistant's "prepare" > signal callback, as opposed to en-queueing it there via idle_add(), then > the GUI doesn't refresh throughout the duration of the long job. This > happens even though I do pump the message queue during the long job via > the usual... > > while Gtk.events_pending(): > Gtk.main_iteration()
There are two easy ways to do a long operation in Python. First, with idle_add(). Your callback should run for no more than 50ms or so before returning. If you need to do more work than that, just wait to be called again. Do not process events, you can leave that up to the main loop. This style is handy for non-blocking, background tasks that don't need interaction from the user. Secondly, with a regular loop that takes control for a long period. You can keep the GUI alive by processing events, as you say above. This style is better for modal actions that either block the GUI or may require interaction. It sounds like you have done both at the same time, which seems confusing to me. I'd make a pure 2) one. If the GUI doesn't refresh, you probably have a bug in your code somewhere. John _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list