[pygtk] Problem with "user response" in pyGTK with more than one thread

Steve McClure smcclure at racemi.com
Thu Aug 27 03:19:58 WST 2009


On Aug 26, 2009, at 12:49 PM, Alexandre Vázquez wrote:

> Hi list!
>
> First of all I want to introduce myself. I'm Alexandre and I'm  
> starting to work with PyGTK and I have a problem right now. I want  
> to explain that problem.
>
> I'm developing a application with a tray icon that he updates  
> automatic every "X" seconds inside a eternal loop. Because of that I  
> need to replace my gtk.Main() call with the following sentence:
>
> thread.start_new_thread(gtk.main, ())
>
> and use for every gtk call the following sentence:
>
> gobject.idle_add(one_gtk_call)
>
> By this way, the gtk events will executed inside another thread and  
> my computation can be done in the main loop. Ok, all right. But now  
> I need to have a input dialog to the user fill his password and I  
> need all the compute stop until the user fill the input, but I can't  
> do that because all the graphics calls are running in a another  
> thread.
>
> Are you can help me to solve that problem? I'd tried anything I  
> could, and read all documentation I have.

I've had much more luck the other way around.  GTK calls go into the  
main thread and I start new threads for other computations, etc.  The  
other threads never touch GTK, they tell the main thread what to do.   
I started back in Gtk 1.something with pygtk 0.6.x and I just was  
never able to get my threads to cooperate when they all tried to do  
GTK call, so I avoided that.

>
> Thanks to all very much!
>
> P.D. If you have more doubts with the problem or you can understand  
> well, tell me, I can tell you more details.
> _______________________________________________
> pygtk mailing list   pygtk at daa.com.au
> http://www.daa.com.au/mailman/listinfo/pygtk
> Read the PyGTK FAQ: http://faq.pygtk.org/

--
Steve McClure
smcclure at racemi.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.daa.com.au/pipermail/pygtk/attachments/20090826/a1699b46/attachment.htm 


More information about the pygtk mailing list