Hi,
I'm on Windows (10 and 11) and I'm developing macro recorder/player. As non-native english speaker I'm using more than one langulage keyboard layout and I discovered lack. I can't record or simulate keys that belong to a different layout than the one I used first.
I was hoping it was caused by my application but the small sample I created behaves exactly the same. It doesn't matter if I switch the language myself or let the script do it, the library still only remembers the language I used first. I also tried to reload the library using importlib.reload but either I don't understand how or it doesn't help. Thanks for all the help.
import time
import importlib
import keyboard
def press_and_release(key):
keyboard.press(key)
keyboard.release(key)
def type_eng():
press_and_release("1")
press_and_release("2")
press_and_release("3")
press_and_release("4")
press_and_release("5")
def type_ces():
press_and_release("ě")
press_and_release("š")
press_and_release("č")
press_and_release("ř")
press_and_release("ž")
print("Please and press enter when you want to start")
input()
# I'm starting with English (United Kingdom) keyboard layout
type_eng()
print("Now I'm switching to another keyboard layout")
# My second language is CES (čeština) so I'll switch into it
press_and_release("alt+shift")
importlib.reload(keyboard)
time.sleep(3)
type_ces()
print("An end that does not occur due to an error")
Hi, I'm on Windows (10 and 11) and I'm developing macro recorder/player. As non-native english speaker I'm using more than one langulage keyboard layout and I discovered lack. I can't record or simulate keys that belong to a different layout than the one I used first. I was hoping it was caused by my application but the small sample I created behaves exactly the same. It doesn't matter if I switch the language myself or let the script do it, the library still only remembers the language I used first. I also tried to reload the library using importlib.reload but either I don't understand how or it doesn't help. Thanks for all the help.