这是我的脚本:
import pyautogui
import subprocess
import time
#notepad is in the file path
programma = "Notepad"
#opening notepad
subprocess.Popen(programma)
#gives time to open notepad, ie I've also tried with higher numbers
time.sleep(1)
pyautogui.keyDown('NumLock')
#I've also tried with
pyautogui.hotkey('alt', 'num3')
我试过了,小键盘可以正常工作:如果我注释掉“alt”并只写
pyautogui.press('num3')
它,输入数字 3。虽然如果我在代码中输入 alt,它会给出一个错误,就好像我在没有光标的情况下打字一样放。我也试过
pyautogui.keyDown('alt')
pyautogui.keyDown('num3')
pyautogui.keyUp('num3')
pyautogui.keyUp('alt')
有谁知道该怎么做?提前致谢