zeldor
zeldor

Reputation: 101

Detecting input keys (Python 3.4.2)

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

Answers (1)

Kevin
Kevin

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

Related Questions