import pyautogui
import random
import time

# 이미지 파일 경로
image_path = 'path/to/image.png'

# 이미지 찾기
while True:
    try:
        # 이미지 위치 찾기
        image_location = pyautogui.locateOnScreen(image_path)
        # 이미지 중심 좌표
        image_center = pyautogui.center(image_location)
        # 이미지 크기
        image_width, image_height = pyautogui.size(image_location)
        # 랜덤 좌표 구하기
        random_x = random.randint(image_center.x - image_width // 2, image_center.x + image_width // 2)
        random_y = random.randint(image_center.y - image_height // 2, image_center.y + image_height // 2)
        # 좌클릭
        pyautogui.click(random_x, random_y, button='left')
        # 1~2초 랜덤한 시간 갭
        time.sleep(random.uniform(1, 2))
        break
    except:
        pass

+ Recent posts