Here:

from gtk import *
from threading import *
import time

class Worker(Thread):
    def __init__ (self, widget):
        Thread.__init__(self)
        self.counter = 0
        self.widget = widget
    
    def run (self):
        while 1:
            threads_enter()
            self.widget.set_text ("Count: %d" % self.counter)
            threads_leave()
            time.sleep(1)
            self.counter = self.counter + 1

win = GtkWindow()
label = GtkLabel()
win.add(label)
win.show_all()

threads_enter()
worker = Worker(label)
worker.start()
mainloop()
threas_leave()

--

Matt

On Sat, Aug 05, 2000 at 06:12:19PM -0500, Rich Wellner wrote:
> I'm having a hard time getting threading to work.  Even when wrapping
> using threads_enter and threads_leave I can't get any but the primary
> thread to have an effect on the gui.
> 
> Does anyone have an example of how this is supposed to work?
> 
> rw2
> 
> -- 
> I think Slashdot represents the oafish bourgeois who wander in a herd,
> trampling to death anything that it finds interesting.
> -Ed Watkeys
> 
> _______________________________________________
> pygtk mailing list   [EMAIL PROTECTED]
> http://www.daa.com.au/mailman/listinfo/pygtk

_______________________________________________
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk

Reply via email to