여러 이미지에 대한 pyautogui.locateOnScreen ()?

Nov 27 2020

당신은 어떻게 할 것 pyautogui.locateOnScreen()여러 이미지의 무리 이미지를?

답변

1 AndrewStone Nov 28 2020 at 19:00

이것을 시도하십시오 :

import os
import pyautogui as py


image_list = []

# Get list of all files in current directory
directory = os.listdir()

# Find files that end with .png or .jpg and add to image_list
for file in directory:
    if file.endswith('.png') or file.endswith('.jpg'):
        image_list.append(file)

# Loop through list to find all the images
for image in image_list:
    print(image)
    print(py.locateOnScreen(image))

이 질문은 다른과 유사 하나 , 나는 두 곳에서 같은 대답을 기록했다.