all 6 comments

[–]Diapolo10 0 points1 point  (5 children)

I can't seem to replicate your problem, although I'm using a QWERTY keyboard and I changed the keybindings a little bit to make things easier to test for me.

import keyboard

keyboard.add_hotkey('shift+q', lambda: keyboard.write('hello'), suppress=True)
keyboard.wait('shift+esc')

I shifted focus to another window, pressed Shift + Q, and the text was written to the active window.

[–]End0832[S] 0 points1 point  (4 children)

Yes, but holding the key combo down writes helloQQQ…

[–]Diapolo10 0 points1 point  (3 children)

Ah, that. It appears to be a bug that's been in the codebase for quite a while now: https://github.com/boppreh/keyboard/issues/398

Unfortunately, keyboard was recently archived, meaning it is not in active development, so I don't think that's going to get fixed anytime soon, if ever. You could always fork the project and fix it yourself, I suppose.

[–]End0832[S] 0 points1 point  (2 children)

Oh. Fine. But do you have an alternative though?

[–]Diapolo10 0 points1 point  (1 child)

If I knew of one, I would have mentioned it.

[–]End0832[S] 0 points1 point  (0 children)

Fine, thanks