[pygtk] Threads in PyGTK: keep typing while ping-ing

John Stowers john.stowers.lists at gmail.com
Tue Feb 17 21:10:53 WST 2009

On Tue, 2009-02-17 at 11:15 +0000, Graham Whelan wrote:
> Hi Mamahita, 
> The problem is that you are calling Thread.join from within the main
> thread. This causes the main thread to stop and wait until the
> PingHost threads have completed, and so it's not updating the
> TextView. You should use a callback to let PingHost return its
> results. Something like this:

But remember, the callback will be executed in the context of the
running thread, which means if you intend to touch the gui from this
thread you will need to get the gtk lock.

That is why I always recommend [1] doing communication from the thread
to the main application using gobject signals emitted in an idle
handler. This way it allows you to retain a normal gobject signal based
design for your app.




More information about the pygtk mailing list