[PyQt] setText from threading

Reinaldo de Carvalho reinaldoc at gmail.com
Thu Feb 21 12:30:39 GMT 2008


"threading" dont have postEvent-like then I must use Qthread?

QThread can be called with threding "target=" like argument? I will
like start methods from PushButtons without freeze mainWidget when
execute.

-- 
Reinaldo Carvalho


On 2/21/08, Phil Thompson <phil at riverbankcomputing.com> wrote:
> 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
>
> _______________________________________________
>  PyQt mailing list    PyQt at riverbankcomputing.com
>  http://www.riverbankcomputing.com/mailman/listinfo/pyqt
>


More information about the PyQt mailing list