--- Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> 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


Malcom,


Thanks for the info. That makes sense.

Since I havent done much gui programming at all, I
really don't know what I'm doing. Could you or anyone
else on the list point me in the direction of any
resources that discuss best practices for doing guis?
Espicially with threading. Not really UI suggestions,
but more of design issues like your raised. I have
heard of MVC (Model-View-Controller) architecture, but
I dont really know what it is...

Thanks again!


__________________________________________________
Do You Yahoo!?
Sign up for SBC Yahoo! Dial - First Month Free
http://sbc.yahoo.com
_______________________________________________
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