keyboard icon indicating copy to clipboard operation
keyboard copied to clipboard

How to remap '§' to '!' while Enter key is pressed

Open Lyfhael opened this issue 1 year ago • 2 comments

Hi,

I have this python script :

import keyboard, time
import pyautogui as pag

keyboard.remap_key("§", )

time.sleep(2)
keyboard.press_and_release('enter')
time.sleep(0.01)
pag.write("!!!")
keyboard.press_and_release('enter')

Since the Enter key is pressed, instead of outputting '!!!' it outputs '§§§' I can't unpress the Enter key otherwise it breaks something else.

So I tried adding keyboard.remap_key("§", "!") but now it outputs '///' My keyboard layout is AZERTY, and I noticed that if I set it as QWERTY if I press on '!' it outputs '/' so there seems to be some sort of logic here. So I thought I would put keyboard.remap_key("§", "&"), because the key that contains "&/1" if I press it with SHIFT then it outputs '!', but the program now outputs "111".

So I thought I would put keyboard.remap_key("§", "1") but now it outputs new lines..

I tried keyboard.key_to_scan_codes("!"), and the each number from the output : (57397, -223, 53), and tried to pass them in remap_key but none worked. Most outputted the same as above

Any ideas ?

Lyfhael avatar Feb 04 '23 18:02 Lyfhael

I noticed I have many other characters that don't display properly, characters like ':' '!' etc

Lyfhael avatar Feb 04 '23 20:02 Lyfhael

I think I solved this problem here: https://github.com/boppreh/keyboard/pull/606 still have a problem with numeric keys though

girvile avatar May 25 '23 08:05 girvile