Open ghost opened 2 years ago
Looking at the code in init.py, isn't this backwards?
def on_press(callback, suppress=False):
"""
Invokes `callback` for every KEY_DOWN event. For details see `hook`.
"""
return hook(lambda e: e.event_type == KEY_UP or callback(e), suppress=suppress)
def on_release(callback, suppress=False):
"""
Invokes `callback` for every KEY_UP event. For details see `hook`.
"""
return hook(lambda e: e.event_type == KEY_DOWN or callback(e), suppress=suppress)
Why is on_press looking for KEY_UP and on_release looking for KEY_DOWN? That seems backwards?
I am sorry if I am being stupid but can I use
keyboard.on_release(foo)
andkeyboard.on_press(bar)
at the same time? I tried the multiprocessing module but nothing seems to work. I tried doing it like thisProcess(target=keyboard.on_press(handle_key_down))
keyboard.on_release(handle_key_up)
I tried doing it like this tooProcess(target=keyboard.on_press(handle_key_down))
Process(target=keyboard.on_release(handle_key_up))
in both the abovekeyboard.on_press()
works perfectly butkeyboard.on_release()
doesn't work.Please tell me how it can be done.