Hey everyone, Why doesn't this work? The code speaks much more clearly than I do, so i shortened it and pasted it below. Running this and clicking on 'Break Me' will... freak out the window...
But... only when the pushbutton_obj.setText("Updated") line is in the thread. If I comment out the threading code and uncomment the line below "#WORKS", the button text updates fine. But in the thread it breaks... I feel like I'm being stupid here, so ANY suggestions are much appreciated. Thanks all. Ben Floyd [EMAIL PROTECTED] #############CUT############# from qt import * import sys import threading class Form1(QMainWindow): def __init__(self,parent = None,name = None,fl = 0): QMainWindow.__init__(self,parent,name,fl) self.setCentralWidget(QWidget(self,"qt_central_widget")) self.pushButton1 = QPushButton(self.centralWidget(),"pushButton1") self.pushButton1.setText("Break Me") self.connect(self.pushButton1,SIGNAL("clicked()"),self.doSomething) def doSomething(self): a = DoStuff() a.go(self.pushButton1) class DoStuff: def go(self, pushbutton_obj): def runThread(): #DOESNT WORK pushbutton_obj.setText("Updated") go = threading.Thread(target=runThread) go.start() #WORKS #pushbutton_obj.setText("Updated") if __name__ == "__main__": app = QApplication(sys.argv) f = Form1() f.show() app.setMainWidget(f) app.exec_loop() -- http://mail.python.org/mailman/listinfo/python-list