Ask coding questions

← Back to all posts
How to I stop a loop as a key is pressed
CarterTimmons03

I have an animation playing in the console. I want the loop to stop when space is pressed. This could be done by breaking or with a while loop. I do not know how to detect keypresses, however. Please help :)

(I added comments)

Voters
CarterTimmons03
Comments
hotnewtop
Geocube101

Try using the getkey module