keyboard = pynput.keyboard.Controller()
def on_each_key_press(key):
print(key)
if(key==Key.enter):#make the pynput type a whenever Enter is pressed
keyboard.type("a")
if key == Key.esc:
# Stop listener
return False
def run():
with Listener(
on_press = on_each_key_press,
) as listener:
listener.join()`
This is the output:
(I pressed the shift and # and ENTER keys myself)
Then the pynput will not only listen to the keys the user types, but it will also listen to the keys that pynput auto types (i.e the "a" after the ENTER key is pressed)
is there a way to stop pynput from tracking its own input?
Hi, I have this issue:
Say I register a keyboard listener like this :
This is the output: (I pressed the shift and # and ENTER keys myself)
Then the pynput will not only listen to the keys the user types, but it will also listen to the keys that pynput auto types (i.e the "a" after the ENTER key is pressed)
is there a way to stop pynput from tracking its own input?