Somehow, this seems to be caused by how rapidly you press the hotkey. For example, if you press Alt + O simultaneously then this happens, but if you press Alt, wait ~1 second, and then press O then it works as expected. Adding something like delay=0.05 doesn't make a difference.
"Certain" (affected) apps = Notepad++ and Notepad, so far. Unaffected apps = Google Chrome and Microsoft Word, so far.
Problem #1: First character of string / text isn't sent
Example:
>>> import keyboard
>>> keyboard.add_hotkey("Alt + O", lambda: keyboard.write("Test"), suppress=True)
Result: Only "est" is written.
Somehow, this seems to be caused by how rapidly you press the hotkey. For example, if you press
Alt
+O
simultaneously then this happens, but if you pressAlt
, wait ~1 second, and then pressO
then it works as expected. Adding something likedelay=0.05
doesn't make a difference.Problem #2: Alt Gr doesn't work
Example:
>>> import keyboard
>>> keyboard.add_hotkey("Alt Gr + Tab", lambda: keyboard.write("Test"), suppress=True)
Result:
My environment (all latest, as of writing):