I am using pynput primarily because there are cases when I don't want the user to have to press enter after supplying an input e.g. when using arrow keys to navigate a CLI.
There are cases where I want to use Python's input
function to extract a user's input and store it in a variable. My problem, however, is the input
function is no longer working as normal and for a line such as
inp = input("Please enter number of seconds for data recording: ")
The prompt is printing but the program doesn't wait for the user input as it normally would.
So how do I get the behaviour I need. The way I'm using pynput is mostly as follows:
with keyboard.Events() as events:
# Block for as much as possible
event = events.get(1e6)
if event.key == keyboard.Key.down:
x = 1
return x