Skip to content Skip to sidebar Skip to footer

Only One Thread Is Starting Python

def pingGetterLoop(): while(1): pingGetter() def mainLoop(): root.mainloop() print('thread two') threadTwo = Thread(target = mainLoop()) print('thread one') thre

Solution 1:

The problem is how you pass the functions to the threads. You call them instead of passing the callable. You can fix that by removing the brackets ():

print("thread two")
threadTwo = Thread(target=mainLoop)
print("thread one")
threadOne = Thread(target=pingGetterLoop)

As both functions contain a endless loop, you never get past calling the first one, which then loops forever.


Post a Comment for "Only One Thread Is Starting Python"