You can use flags to communicate between two threads. For example define a Boolean variable stop=True (as a member of a common object between two threads), and check(read) this stop flag frequently in the main thread. And set it to False in the other thread (when the password entered correctly). This is a general idea specially in a multithread program.
On 8/26/09, Steve McClure <[email protected]> wrote: > > 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 [email protected] >> http://www.daa.com.au/mailman/listinfo/pygtk >> Read the PyGTK FAQ: http://faq.pygtk.org/ > > -- > Steve McClure > [email protected] > > _______________________________________________ pygtk mailing list [email protected] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://faq.pygtk.org/
