Reputation: 101
This is probably pretty simple, but I can't find the answer anywhere. I basically want some code that detects different key presses (enter, left etc) and then saves the type of key in a variable.
Upvotes: 0
Views: 656
Reputation: 76194
If you're on Windows and only want to get input when your window has keyboard focus, you can use msvcrt.getch
:
Read a keypress and return the resulting character. Nothing is echoed to the console.
Upvotes: 1