[PyQt] setText from threading
Phil Thompson
phil at riverbankcomputing.com
Thu Feb 21 14:21:25 GMT 2008
On Thursday 21 February 2008, Reinaldo de Carvalho wrote:
> > > QThread can be called with threding "target=" like argument? I will
> > > like start methods from PushButtons without freeze mainWidget when
> > > execute.
> >
> > Just reimplement QThread.run() and call your simulate() function.
>
> I have one hundred methods called by pushButtons, then a need
> reimplement a QTread for each method, and creata a postEvent for each
> (~ three hundreds) access to Qtgui objects?
You don't need a different QThread sub-class for each method. You only need
one that takes an argument that is the callable to call from run() - just
like you were passing it as "target=" before.
How many event types you need depends on how many different things you want to
do in the main thread. You could get away with just one if you used it to
pass a reference to another callable which the event handler in the main
thread called to do the updates.
Phil
More information about the PyQt
mailing list