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]

Reply via email to