Open heyouwei2021 opened 2 years ago
https://github.com/asweigart/pyautogui/blob/master/docs/simplified-chinese.ipynb
import pyperclip
import pyautogui
# PyAutoGUI中文输入需要用粘贴实现
# Python 2版本的pyperclip提供中文复制
def paste(foo):
pyperclip.copy(foo)
pyautogui.hotkey('ctrl', 'v')
foo = u'学而时习之'
# 移动到文本框
pyautogui.click(130,30)
paste(foo)
Thank you. But my question is not to input Chinese characters. I need to input the Unicode of 'a' to the game. The game can only accept Unicode not text. How should I handle it?
Regards,
doesn't work with python 3 either.
both pyautogui.write('你好')
and pyautogui.write(u'你好')
outputs nothing.
Hi all,
I hope everyone is well. I get this behaviour too. I tried a few tests but unless i set my terminal to Chinese or my terminal encoding enable "Unicode East Asian Ambiguous Characters are wide" i get strange behaviour as it doesn't know how to interpret the characters. it works in bash but not when in the python3 interpreter.
I believe this might be what languages are supported on your computer. I do not know if this will help, but i found these:
https://developpaper.com/how-to-install-chinese-version-and-python-intelligent-perception-in-vscode/
https://stackoverflow.com/questions/22528001/pip-install-on-chinese-server-ssl-error
Good luck.
Cheers!
Other than chinese characters, it seems like invisible characters and some symbols (primarily arrows, shapes and more) do not show up at all. The braille font and items also seem to fail.
This library seems to do the trick: https://pynput.readthedocs.io/en/latest/keyboard.html#controlling-the-keyboard
You can use keyboard.press()
to input unicode characters.
How to input Unicode?