简体   繁体   English

如何使用 pyautogui 按 alt + num x(任何数字键盘键)

[英]how to press alt + num x (any numpad keys) using pyautogui

i'm trying to print some symbols using python.我正在尝试使用 python 打印一些符号。 i can print it with keyboard by clicking alt+numx (x=number of the symbol).我可以通过单击 alt+numx(x=符号的编号)用键盘打印它。 i'm trying to do this using pyautogui but it is not working.我正在尝试使用 pyautogui 执行此操作,但它不起作用。



             *import pyautogui*
             pyautogui.keyDown('alt')
             pyautogui.press('num 1')
             pyautogui.keyUp('alt') ```



if there other library to do this help me.
**this following text is not related to the question so do not read it.**
Edit: following is the official solution from Google (link)

Summary
Google Maps SDK thread crashes App (ArrayIndexOutOfBoundsException) - Solution Offered

Description
On April 23 2020 starting at 11:30 PDT, Google served for 4 hours an update to the configuration of a Maps mobile component, triggering crashes in Maps SDKs for Android and iOS. Applications on devices that downloaded this version of the configuration (during the outage period) were vulnerable to the crash. Workaround solutions are offered for Maps SDKs for Android and iOS.

Maps SDK for Android                            

Hi Refer to the document it briefly mentioned.嗨,请参阅它简要提到的文档。

https://pyautogui.readthedocs.io/en/latest/keyboard.html https://pyautogui.readthedocs.io/en/latest/keyboard.html

Try below if work for you如果对您有用,请在下面尝试

import pyautogui
pyautogui.hotkey('alt', 'num 1')

Another idea (if you need one character only) is to copy it and do:另一个想法(如果您只需要一个字符)是复制它并执行以下操作:

with pyautogui.hold('ctrl'):
    pyautogui.press(['v'])

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM