返回顶部

屏幕截图与定位识别

# -*- coding: utf-8 -*-
import pyautogui
import os


file_url = os.getcwd() + '/file/img.png'


# 屏幕截图
def demo1():
    pyautogui.screenshot(region=(0, 0, 1920, 1080),
                         imageFilename=file_url)


# 定位识别
def demo2():
    location = pyautogui.locateOnScreen(r'file/img.png')
    print(pyautogui.center(location))


demo1()
demo2()

 

posted @ 2022-10-03 20:00  gz_zyg  阅读(60)  评论(0编辑  收藏  举报