Try adding calls to threads_enter() and threads_leave() around the gtk
calls in the child thread. They help gtk handle threading (as it is not
absolutely completely thread safe, and the overhead of adding locking to
every single function is fairly high).
James.
--
Email: [EMAIL PROTECTED]
WWW: http://www.daa.com.au/~james/
On Tue, 14 Mar 2000, Siegmund Fuhringer wrote:
> hi...
>
> i got a problem:
> i want to change a label in a new thread, but it only works, when i use the
> Thread.join() methode to wait for the end of the thread. (and that's not
> useful)
>
> is there a possibility to do it without a Thread.join()?
>
>
> thanx - sifu
>
>
> from gtk import *
> from threading import *
>
>
>
> class Test(Thread):
> def __init__(self, window, *args):
> Thread.__init__(self, name="TestThread")
> self.window=window
>
> def run(self):
> self.window.label.set_text("neuer Text")
>
>
> class Oberf(GtkWindow):
> def __init__(self):
> GtkWindow.__init__(self, WINDOW_TOPLEVEL)
> self.set_title("Muhkuh")
> self.connect("destroy", mainquit)
>
> box=GtkVBox()
> self.add(box)
> box.show()
>
> self.label=GtkLabel("muh")
> box.pack_start(self.label)
> self.label.show()
>
> button=GtkButton("thread")
> button.connect("clicked", self.button_clicked)
> box.pack_start(button)
> button.show()
>
> self.show()
>
>
> def button_clicked(self, *args):
> th=Test(self)
> th.start()
> # th.join()
>
> def mainloop(self):
> mainloop()
>
>
>
>
> oberf=Oberf()
> oberf.mainloop()
>
> To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]
>
To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]