On Mon, 2005-14-03 at 13:23 +0100, Le Boulanger Yann wrote: > Hi, > > I've a problem when I use gtk.Dialog.run() funtion in a thread > I attached a small example that shows the problem. > If you run test.py, it works (in this case threads are not used). > But now if you run core.py (which launch a thread that does exactly the > same thing) when I press a key in the dialog window, the dialog is not > destroyed and the application freezes. > I don't understand why this happens and what can I do to have it working > with threads. > My intention is from the thread to run() the dialog and wait for the > user to give the password and then use it. run() would normally do this, > but it freezes with threads. I saw a workaround in FAQ 10.17 (about > dialog.run running in the mainloop), but that won't block in a mainloop > so it doesn't suit me. > > does someone has an idea ?
You are running the dialog from a thread which is not good. You should run all gui stuff from the main thread, even if they are controlled by other threads. Here is an example of thread safe communication and control that can easily be changed to do what you were trying to do in your core.py. The dispatcher function in this example can pass arbitrary data between threads as long as each party knows what to expect. This makes it very universal so that it can be used by many different threads with different data passing needs. -- Brian <[EMAIL PROTECTED]>
dispatcher.py
Description: application/python
_______________________________________________ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/