Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

user32.keybd_event trigger a release for modifiers, which makes send function glitched #601

Open
SunOfJudge opened this issue Apr 4, 2023 · 1 comment

Comments

@SunOfJudge
Copy link

It seems that on windows platform _os_keyboard eventually calls user32.keybd_event.
However, it makes the pressed modifiers to release for some reason.
Note that modifiers and non-modifiers are different and this affect only modifiers.
You can replicate it through the following code:

import keyboard, time
while True:
    time.sleep(2)
    keyboard._os_keyboard.press(keyboard.key_to_scan_codes("right")[0])

Hold shift key and run the code, you will find that the text cursor moves but the text is not selected, which is a proof that the shift key is released for a sudden.
This can be patched by modifying send function.

@girvile
Copy link

girvile commented May 25, 2023

I think because right is an extended key (0xE05D), it is misread. maybe this can fix your problem: #606

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants