[pygtk] Wait until a thread is ended

David M. Cook dave at davidcook.org
Fri Sep 29 04:52:34 WST 2006


On Thu, Sep 28, 2006 at 09:16:20PM +0200, Adolfo González Blázquez wrote:

> I would like to know if someone can point me a solution to make a
> function run as a separate thread, and wait until it is ended, without
> blocking the gui.

> In my application, i'm getting a long file listing using glob(), and i
> want this function to run as a thread, so the user can stop it using a
> button in the gui (right now, the gui freezes till glob is ended), and
> then run another function to fill the treeview (this now works without
> blocking the gui, using generators). .

Use a callback to handle the result and call it from your thread with
gtk.idle_add().

Dave Cook



More information about the pygtk mailing list