首页 > 其他分享 >pyautogui.locateOnScreen在屏幕上查找图片并点击

pyautogui.locateOnScreen在屏幕上查找图片并点击

时间:2023-03-10 17:23:05浏览次数:40  
标签:pyautogui center top height 查找 locateOnScreen import

1.在Win10中任意窗口按下"Win+Shift+S"组合键进入截屏模式 ,截图并保存为 n.png

2.代码:

#encoding=utf-8
import pyautogui
from PIL import Image
import time

time.sleep(3)
left, top, width, height = pyautogui.locateOnScreen(r"n.png")
center = pyautogui.center((left, top, width, height))
pyautogui.click(center)

  

 

标签:pyautogui,center,top,height,查找,locateOnScreen,import
From: https://www.cnblogs.com/pu369/p/17204125.html

相关文章