首页 > 其他分享 >屏幕截图与定位识别

屏幕截图与定位识别

时间:2022-10-03 20:11:20浏览次数:93  
标签:pyautogui 截图 img location file 屏幕 识别

# -*- 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()

 

标签:pyautogui,截图,img,location,file,屏幕,识别
From: https://www.cnblogs.com/zhaoyiguang/p/16749820.html

相关文章