boppreh / keyboard

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

`keyboard.write` being affected by the keyboard language #654

Open LeeFuuChang opened 2 months ago

LeeFuuChang commented 2 months ago

Issue

When I run the code below on different keyboard language (UK / US / TW / EN ...), the result differs.

import keyboard
import time

# wait 1 second so I can focus the text editor 
# making the 'keyboard.write' result type in editor
time.sleep(1)

keyboard.write("English 中文 한국어 Русский")

Demo

螢幕錄影 2024-08-13 晚上10 10 13

Expected behavior

It should always write English 中文 한국어 Русский regardless of the keyboard language.