On Sun, Jul 07, 2002 at 06:29:37PM -0700, icewind wrote:
[...]
> Thanks. I tried that and it doesnt work. It may have
> to  do with the fact that I am trying to insert that
> code in a seperate thread. I have a thread that sits
> waiting for network connections and when one is
> detected, it updates the gui. I have the thread wait
> in a while loop for something to read from the socket.
> In that while loop I put the code you suggested. When
> I run the application, I get the following message
> output (many times):
> 
> GLib-WARNING **: g_main_iterate(): main loop already
> active in another thread

Urrgh. Don't do that. :-(

The "traditional" method to accomplish what you are trying to do here is
to have one thread which is solely respnosible for updating the gui and
calling gtk_main_iteration(), etc. The other threads will set shared
variables which will be read by the "gui" thread and used to update the
visual portions of the output.

So, for example, your network reading thread could update a "bytes read"
variable and periodically your gui thread would read that variable and
use it to update a progress bar or whatever.

Cheers,
Malcolm
_______________________________________________
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to