For example:
def main():
time.sleep(10)
pass
main()
How to break this loop by pressing 'q'?
For example:
def main():
time.sleep(10)
pass
main()
How to break this loop by pressing 'q'?
Haven't tested it, but i think this should work.
global stop
stop = False
def main():
time.sleep(10)
if keyboard.is_pressed('q'):
global stop
stop = True
if stop:
return 0
else:
main()