pyautogui moveto不工作(坐标正确)


import pyautogui
while True:
test = pyautogui.locateCenterOnScreen('test.png',region=[600,570,680,570],grayscale=False,confidence=.6)
if test:
pyautogui.moveTo(1000,1000)
print(str(test),'found',test.x,test.y)
break

print语句正在运行(所以if语句并没有被访问(如果在while语句之外运行,那么移动到也会起作用

随着进一步的检查/测试,visualstudio代码必须以管理员身份运行,以便(moveto(在不是重点应用程序的情况下工作。也就是说,如果你正在使用(moveto(,并且visualstudio代码有焦点,(movedo(就会起作用。

最后,以(moveto(的管理员身份运行VS CODE以正确工作。

最新更新