Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

how can I use persian language text in pyautogui library

I want to fill some fields using pyautogui library
But the problem is that when I want to fill the fields in Persian language, it is not done
How should I solve the problem of this library in the Persian language?
I don’t even know if the problem is with this library or with my Python because this library works well for the English language

my code:

import pyautogui
pyautogui.click(x=36, y=52)
pyautogui.write("Hello World") #This part works well
pyautogui.press('tab')
pyautogui.write("سلام دنیا")  #This part does not work

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

pyautogui library doesn’t support languages except English. As recommended on this post you can use pyperclip in addition to pyautogui:

import pyperclip
import pyautogui
import time

pyautogui.click(x=36, y=52)
pyautogui.write("Hello World") #This part works well
pyautogui.press('tab')

content = "سلام دنیا"

pyperclip.copy(content)
time.sleep(0.5)
pyautogui.hotkey('ctrl', 'v')
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading