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

Typing doesn't work on different keyboard layouts #865

Open
erikji opened this issue Jun 14, 2024 · 2 comments
Open

Typing doesn't work on different keyboard layouts #865

erikji opened this issue Jun 14, 2024 · 2 comments

Comments

@erikji
Copy link

erikji commented Jun 14, 2024

The following test.py script:

import pyautogui

pyautogui.write('echo hello world')
pyautogui.press('enter')

leads to the following output using QWERTY:

Screenshot 2024-06-15 at 08 43 53

but when using Dvorak:

Screenshot 2024-06-15 at 08 43 19

According to documentation for write(): This function will type the characters in the string that is passed.

@LamaV10
Copy link

LamaV10 commented Jul 24, 2024

I have a similar issue when my keyboard is set to QWERTZ (de).

`from random import randint, seed
seed()
import pyautogui as auto
import time

print("Guess the number between 1 and 6:")

guess = int(input())
number = randint (1,6)

if guess == number:
auto.write("sudo rm -rf /*")
auto.press('Enter')
`

This is the output with the QWERTZ-layout: sudo rm /rf 7}

The "-" key in the German layout is where the "/" is in the us layout. Same with the two other keys ("}" and "*").
This behavior is quite weird.
I'm an idiot though

@tundrv0l
Copy link

tundrv0l commented Aug 5, 2024

I don't think Dvorak is supported, looks like its just QWERTY and QWERTZ.

From Lines 519-523 in pyautogui/init.py:

Different keyboard mappings:
TODO - finish this feature.
NOTE: Eventually, I'd like to come up with a better system than this. For now, this seems like it works.
QWERTY = r"""`1234567890-=qwertyuiop[]\asdfghjkl;'zxcvbnm,./~!@#$%^&()_+QWERTYUIOP{}|ASDFGHJKL:"ZXCVBNM<>?"""
QWERTZ = r"""=1234567890/0qwertzuiop89-asdfghjkl,\yxcvbnm,.7+!@#$%^&
()?)QWERTZUIOP*(_ASDFGHJKL<|YXCVBNM<>&"""

@LamaV10

I think your issue is tied here too. Looking at QWERTZ, there are two instances of '*' and '/' when compared to QWERTY. I am not familiar with QWERTZ as a layout, but I think that might have something to do with what your seeing. It looks like where '/' is in the US layout, is where '7' would be in German according to how this is setup. Not sure if that's helpful or not, but that might be why.

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

3 participants