I want to use the msvcrt module in python, but I can't make it work.
I am on windows 10, have several "active keyboards" (I can change it from azerty to qwerty and stuff) and did not do/download anything except Python3 itself (I'm saying that because maybe there are some requirements or manipulations to do that I don't know about).
What I'd like to do is simple -- press a key, and then do something according to the key that was pressed (so I need my computer to identify that key).
I tried it using the following code:
import msvcrt
while 1: #is that necessary?
char = msvcrt.getch()
if char == ??? #that's what I'm struggling with
print("yay")
else:
print("nope")
I simply don't know how to "call" my key. I've tried for example '\r', char(13), ASCII codes and so on, but none of these worked. Chances are, they're supposed to but I'm doing it wrong- by not working I mean, I could never get a "yay", though the "right" key was pressed.
Thanks in advance!