Nice article. I have question, it is possible use this template for function which we start by pressing button and break by pressing another button?
I would like to ask for help with stopping thread (as Pshemas did some time ago).
I have tried to add signal stop but I do not know how to emit that.
I wrote a program using this article. But I do not know how to pause or stop all processes. Please, help.
Hi, I’m working on a data sample and plot GUI, which communicates with an external device, I’ve read the tutorial and helps me a lot. The issue is how to handle start and stop QRunnable in follow to start and stop communication engine.
In my code, my thread uses a while loop. So what I did is I created a variable called self.active = True inside class Worker which is used to control the while loop (while active). When I want the loop to stop I simply call worker.active=False and I make sure to set worker.setAutoDelete(True) so the thread is deleted automatically upon exit.
To make a thread pause I’m thinking you could place a while loop with argument self.pause=True.
I’m not sure if you would like my pause solution, but it’s an option.
There is a working example of Steven’s idea on this topic with a pause/resume/stop methods added to the worker.