Re: GUI freezes waiting for callback function to return



On 13 December 2012 13:57, Mateusz Marzantowicz
<mmarzantowicz osdf com pl> wrote:
My application is supposed to do some extensive file operations which
may take a while depending on number of files. I can chunk the work as
John suggested but I don't like this approach. I prefer to use threading
of some kind and I'm little bit disappointed that GTK+ doesn't offer
that out of the box for menus, actions and callbacks.

The gtk way is actually better (in my opinion). Callbacks running in
their own threads would introduce all sorts of horrible problems with
locking in even the simplest program. Having callbacks run by the GUI
thread means no callback can interrupt another callback, except via
the main loop. Much simpler!

The pygtk faq has some sample code with threading:

http://faq.pygtk.org/index.py?file=faq20.006.htp&req=show

You may be able to adapt that to pygobject.

There was a thread about this back in July that gives some background.
It's C, but it might be useful to you:

https://mail.gnome.org/archives/gtk-app-devel-list/2012-July/msg00021.html

John



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]