pyautogui图片识别locateAllOnScreen

发布时间:2023-08-03 23:30:20 阅读:2030次

pyautogui图片识别locateAllOnScreen

import pyautogui
# image = pyautogui.screenshot()
# image.save('screen.png')
# 搜索并返回所有匹配的位置
confidence = 0.99
wechat_icon = pyautogui.locateAllOnScreen('1.png', confidence=confidence)
# matches = pyautogui.locateOnScreen('wx.png')
# print(wechat_icon)
# # 遍历匹配位置并打印
for match in wechat_icon:
    print(match)
    msg_input_center = pyautogui.center(match)
    print(msg_input_center)
    pyautogui.doubleClick(msg_input_center)
# x, y = pyautogui.position()
# print(f"鼠标当前坐标:({x}, {y})")

如有问题,可以QQ搜索群1028468525加入群聊,欢迎一起研究技术

支付宝 微信

有疑问联系站长,请联系QQ:QQ咨询

转载请注明:pyautogui图片识别locateAllOnScreen 出自老鄢博客 | 欢迎分享