import keyboard
def on_c_pressed():
print("C key was pressed")
keyboard.add_hotkey('c', on_c_pressed)
Current situation is that it fires rapidly as the keystroke is actuated and being released.
One solution is to keep track of a global variable flag and have on_c_pressed() and on_c_released but that seems a little messy. Do any of you know a cleaner way or an alternative library that detects when I press a key state once per press?