I was trying to make a while loop which would stop running when a specific key is pressed. The problem is that the loop runs infinitely. My loop:
import time
import keyboard
while (not keyboard.is_pressed("esc")):
print("in loop...")
time.sleep(2)
I am using the keyboard
module. What is wrong with my loop and how can I fix it?
(I don't really want to use a Repeat-until or equivalent loop in Python thing in this case.)