I want a timer, but I want it to just affect one function, so it can't just be
sleep()
.
For example:
def printSomething():
print("Something")
def functionWithTheTimer():
for i in range(0, 5):
#wait for 1 second
print("Timer ran out")
Say the first function is called when a button is clicked, and the second function should print something out every second, both should act independently.
If I used sleep()
, I couldn't execute the first function within that one second, and that's a problem for me. How do I fix this?