How to start/stop or pause running threads?

Heads up! You've already completed this tutorial.

Pshemas | 2020-05-11 07:17:31 UTC | #1

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?

anonymous | 2020-05-10 21:32:56 UTC | #2

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.

Alex | 2020-05-11 07:16:33 UTC | #3

I wrote a program using this article. But I do not know how to pause or stop all processes. Please, help.

luciano | 2020-05-11 07:18:18 UTC | #4

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.

Steven_K_Peters | 2020-11-16 20:54:11 UTC | #5

In my code, my thread uses a while loop. So what I did is I created a variable called = True inside class Worker which is used to control the while loop (while active). When I want the loop to stop I simply call 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. while self.pause: time.sleep(1)

I'm not sure if you would like my pause solution, but it's an option.

martin | 2020-11-16 20:54:11 UTC | #6

There is a working example of Steven's idea on this topic with a pause/resume/stop methods added to the worker.

The complete guide to packaging Python GUI applications with PyInstaller.
[[ discount.discount_pc ]]% OFF for the next [[ discount.duration ]] [[discount.description ]] with the code [[ discount.coupon_code ]]

Purchasing Power Parity

Developers in [[ country ]] get [[ discount.discount_pc ]]% OFF on all books & courses with code [[ discount.coupon_code ]]
Well done, you've finished this tutorial! Mark As Complete
[[ user.completed.length ]] completed [[ user.streak+1 ]] day streak

How to start/stop or pause running threads? was written by Martin Fitzpatrick .

Martin Fitzpatrick has been developing Python/Qt apps for 8 years. Building desktop applications to make data-analysis tools more user-friendly, Python was the obvious choice. Starting with Tk, later moving to wxWidgets and finally adopting PyQt.