[PyQt] pausing and resuming QThread tasks
Scott Frankel
frankel at circlesfx.com
Mon Apr 19 18:43:14 BST 2010
Hi Stefano,
My working example code is attached. Glad you're finding it useful.
Scott
-------------- next part --------------
A non-text attachment was scrubbed...
Name: threadTest.py
Type: text/x-python-script
Size: 6825 bytes
Desc: not available
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20100419/14f2f545/attachment.bin>
-------------- next part --------------
On Apr 18, 2010, at 9:54 PM, Massimo Di Stefano wrote:
> Hi,
>
> i'm tring to modify the code you pasted
> using the suggested modification, but i'm not able to run it
> with a "working" pause action.
>
> Can you point me to a working version,
> i'm tring to learn from it.
> It is a cool example to learn how to use thread in PyQt
>
> Thanks a lot!!!
>
> Massimo.
>
>
> Il giorno 15/apr/2010, alle ore 22.24, Russell Valentine ha scritto:
>
>> What about just put this in your for loop. Then the pause/resume
>> button
>> or whatever just toggles self.paused? That seems good to me.
>>
>> while(self.paused):
>> QThread.msleep(100)
>>
>>
>> On 04/15/10 13:53, Scott Frankel wrote:
>>>
>>> Hi all,
>>>
>>> What's the best way to pause and resume processing in QThread
>>> objects?
>>>
>>> I've built a small test app that sets up a Python os.walk()
>>> process that
>>> I'd like to be able to pause and restart from where it left off.
>>> The
>>> documentation on QWaitCondition looks promising, though my app
>>> appears
>>> to hang on this line (line 69):
>>>
>>> self.condition.wait(self.mutex)
>>>
>>> Also, in testing for a paused job in my processing method (line
>>> 104),
>>> does a waiting thread resume from where it left off? Or do I need
>>> to
>>> keep track of where it is myself and restart it from there?
>>>
>>> Thanks in advance!
>>> Scott
>>>
>>>
>> _______________________________________________
>> PyQt mailing list PyQt at riverbankcomputing.com
>> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
>
> _______________________________________________
> PyQt mailing list PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
>
More information about the PyQt
mailing list