[PyQt] setText from threading

Phil Thompson phil at riverbankcomputing.com
Thu Feb 21 12:10:20 GMT 2008


On Thursday 21 February 2008, Reinaldo de Carvalho wrote:
> 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)

No, you have obscurred the problem, not solved it. Your design is broken for 
the reasons Andreas has given.

Phil


More information about the PyQt mailing list