Here is my code.
import keyboard
while num <= total_num_list-1:
show_num = num + 1
duration_in_min = 1:30
t = 1
while t <= duration:
if keyboard.is_pressed("n"):
break
time.sleep(1)
time_in_min = time.strftime('%M:%S', time.gmtime(t))
print(f"{time_in_min}/{duration_in_min}")
t += 1
num += 1
This code is working for now, but it needs me to hold the "n" key to break the loop because of the delay. What I want is it to have a immediate respond to my key press. What modules can I use or what should I do to make it work?
I am a beginner, sorry if there is any mistakes.