Python - QThreadPool Help me

junior04

Junior Member
Joined
Jan 1, 2021
Messages
124
Reaction score
34
Hi,

I need to start and end buttons but i can't. Please help me

pool = QThreadPool.globalInstance()
runnable = Runnable(n)
if n == 1:
pool.start(runnable)
else:
pool.cancel(runnable) # Don't work

How can i this thread end?

Thanks
 
I am trying this code;

Python:
for user in users:
    #start
   
   
    #end
   
    if stop == True:
        break

How can i this? I am using Pyqt5 and I want it to stop when I click the button
 
I done. Thank you.
Python:
for user in users:
    ##start
   
   
    ##end
   
    if dead == True:
        print("Pause")
        while True:
            if dead == False:
                print("Resume")
                break

Python:
global dead

if n == 1:

    pool.start(runnable)

elif n == 2:

    dead = True

    self.a = 3

    self.countBtn2.setText("Resume")

elif n == 3:

    dead = False

    self.a = 2

    self.countBtn2.setText("Pause")
 
Back
Top