As pointed out bye @micseydel this can be platform(s) depended.
To get it to work like
has to listen to keyboard event(this is usually called to Hook keyboard events).
There are modules like keyboard,that could do this.
I have used pyhooked before,but that is a Windows solution.
And i see that someone has ported it to Linux(blog).
pynput 1.2 look nice,and is updated and cross-platform.
To get it to work like
"read -n" command
,has to listen to keyboard event(this is usually called to Hook keyboard events).
There are modules like keyboard,that could do this.
Quote:Listen and sends keyboard events.
Works with Windows and Linux (requires sudo).
I have used pyhooked before,but that is a Windows solution.
And i see that someone has ported it to Linux(blog).
pynput 1.2 look nice,and is updated and cross-platform.
Quote:Monitoring the keyboard
Use pynput.keyboard.Listener like this: