keyboard
keyboard copied to clipboard
OnPress and OnRelease not working at the same time
Consider the following script
import keyboard
def onRelease(e):
print("Released: " + e.name)
def onPress(e):
print("Pressed: " + e.name)
keyboard.on_press(onPress)
keyboard.on_release(onRelease)
while True:
import time
time.sleep(1000)
I expect, OnPress to fire when the key is down and OnRelease to fire when the key is released. Its not doing that for me. If i however uncomment the assign callback function for onPress, onRelease fires. It seems onRelease doesnt fire anymore when onPress is hooked.
Does that make sense`?