Collins wrote:
>On Sat, 6 Jul 2002 22:02:27 -0700 (PDT) icewind <[EMAIL PROTECTED]>
>wrote:
>
>
>>I have a couple of threads updating the gui (adding
>>lines to a CList, changing text in a textentry area,
>>etc.) The problem is, the widget that was changed
>>doesnt show its updates until some event occurs such
>>as me moving or clicking the mouse into the
>>applications window. I would like the gui updated
>>continuously as the threads actually manipulate the
>>widgets.
>>
>>So, I assume this could be done by calling an
>>"invalidate" function that will tell gtk that some
>>widget needs to be redrawn. If this is how to do what
>>I want, what is the name of the function/method I have
>>to call, and is it something I have to apply to just
>>the widget that was changed or to the window the
>>widget is in or something else?
>>
>>
>________________
>
>
>>pygtk mailing list [EMAIL PROTECTED]
>>http://www.daa.com.au/mailman/listinfo/pygtk
>>Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
>>
>>
>
>I got this little nugget from someone on the list a month or two back.
>
> while events_pending(): # suggested by pygtk users
> mainiteration(FALSE)
>
>
If you don't mind requiring Python 2.2 (which you would need to if you
are using the 2.0 bindings), you can also use the following pattern:
from __future__ import generators
import gtk
def worker_function():
# do some work
yield gtk.TRUE
# do some more work
yield gtk.TRUE
# even more work
yield gtk.TRUE
# ... (til we are finished)
yield gtk.FALSE
gtk.idle_add(worker_function().next)
gtk.main()
this puts the main loop in control, which will continue your subroutine
when it is not busy, rather than your code having control (when you may
starve the GUI more).
James.
--
Email: [EMAIL PROTECTED] | Linux.conf.au 2003 Call for Papers out
WWW: http://www.daa.com.au/~james/ | http://conf.linux.org.au/cfp.html
_______________________________________________
pygtk mailing list [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/