boppreh / keyboard

Hook and simulate global keyboard events on Windows and Linux.
MIT License
3.76k stars 433 forks source link

Minimal capture of Key event on press and release only gets one event #575

Closed Bobypalcka closed 9 months ago

Bobypalcka commented 1 year ago

I am trying to catch all key combinations pressed at same time, but I only get one keyboard event. Ether on_press or on_releasee, depending which line is first registered. How could I get both events?

import keyboard

def pressed(event):
    print(f"Down: {event.name}")

def released(event):
    print(f"Up: {event.name}")

if __name__ == "__main__":
    keyboard.on_press(pressed)
    keyboard.on_release(released)
    keyboard.wait("escape")
Bobypalcka commented 1 year ago

Read https://github.com/boppreh/keyboard/issues/152