Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Missing symbols in Pyautogui typewriter

I have a problem, that consists in following: Pyautogui typewrite won't type letters, only numbers. For example, when I execute

pyautogui.typewrite("abc123")

only "123" appears. This question is similar to this one: Pyautogui typewrite is writing only numbers Unfortunately, there are no answers about the issue, as well as other Internet topics. I have the Windows 7 machine and Python 3.5.

like image 773
Paul Bobyrev Avatar asked Oct 23 '25 16:10

Paul Bobyrev


2 Answers

There seems to be a bug in the typewrite function of PyAutoGui. I workaround it with this function which preprocesses the string into keypresses instead. Note that this version of the function leaves a comma at the end of the output array so that you can easily append more characters or button presses at the end.

def preprocess(something):
    something = str(something)
    output = []
    for x in range(len(something)):
        output.append(something[x])
        output.append(',')
    return output
like image 180
Matthew Fairleaf Avatar answered Oct 25 '25 05:10

Matthew Fairleaf


I had the same problem couple of days ago

Try using other pyautogui functions that presses keyboard keys like pyautogui.press("k")

If you have a problem with all keyboard functions related to letters in general it's probably because your default input language is set to something other than english

you can fix that easily by going to your keyboard and input settings and changing the default input language to english

you'll still be able to write in your first language and it will hopefully solve your problem

like image 31
Ahmed M. Adly Avatar answered Oct 25 '25 06:10

Ahmed M. Adly



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!