Whenever I press the ESC key (anywhere on my desktop), I would like to print a message.
This is what I have so far:
from msvcrt import getch
while True:
key = ord(getch())
if key == 27:
print('Key pressed.')
When I run this code and hit ESC, I get nothing - not even an error. Why?
print(key)
keeps giving me 255 repeatedly, even if I press nothing.