[PyQt] setText from threading

Reinaldo de Carvalho reinaldoc at gmail.com
Thu Feb 21 11:45:19 GMT 2008


I solved the problem setting null strig to textLabel1 before start thread:

[...]

def thread_start( self ):
   self.gbox.setEnabled(False)
   self.textLabel1.setText("")
   self.thread1 = threading.Thread(target=self.simulate)
   self.thread1.setDaemon(1)
   self.thread1.start()

def simulate( self ):
i = 0
while i < 10:
   print str(i)
   self.textLabel1.setText(str(i))
   time.sleep(1)
   i = i  + 1

[...]

Other solution is use language()*  setting and unsetting any value
from Qtdesigner. Pyuic will add:

* self.textLabel1.setText(QString.null)

-- 
Reinaldo Carvalho


More information about the PyQt mailing list