On Mon, 25 Mar 2002 17:01:25 +0200
"Lior Kesos" <[EMAIL PROTECTED]> wrote:

> I'm using a label to store a status of a certain task which freezes up 
> the gui because it's heavy.
> I have two questions:
> 
> 1. Will some kind of threading take the stress of the gui (it blanks 
> while mysql operations are being made and sometimes these take time and 
> the gui is stuck untill the mysql queries are finalized)

See below. I've never use threading if I can avoid it - threading
makes my brain hurt. And Alan Cox says, "Threads are for people
that don't understand state machines."  ;=)

> 2. Is there a way to "refresh" the label because after my set_text 
> method the next thing are the sql queries and I can withstand the gui 
> getting stuck as long as the correct status (Heavy SQL work please be 
> patient) appears and explains why it's stuck.

I think what you are hitting is the same thing I hit a while back - 
things are too piled up for your change to be displayed. It's the
same problem with progressbars.  They work great when trying one
out for a sample, but if what you are doing locks gtk (I don't
mean lock up just lock as in mutex) then you have no luck. Here's
how I did it:

(inside a function)

  myProgressBar.pbar.set_value(new_value)
  while gtk.events_pending():
    gtk.mainiteration()

It works for me.  Not sure if it is the "right" thing to do, though.
When I call gtk.mainiteration() I can almost here the "kerchunk".

-- 
The Amazing* Jon Nelson <[EMAIL PROTECTED]>
C and Python Programmer, Code Gardener
Just because it's not broken doesn't mean we can't take it apart.
  (* may not actually amaze)
_______________________________________________
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