from PIL import Image from mss import * from pyautogui import * import utils.cv2 FAILSAFE = False screen_size = size() screen_x, screen_y = screen_size.width, screen_size.height if __name__ == '__main__': if not os.path.exists("snap"): os.mkdir("snap") with mss() as m: monitors = m.monitors[:1] for (i, monitor) in enumerate(monitors): print(monitor) img = m.grab(monitor) pim = Image.new("RGB", img.size) pim.frombytes(img.rgb) # loc = utils.cv2.match(pim, "assets/images/win_win10.png") # if loc is not None: # x, y = loc # moveTo(x, y) loc = utils.cv2.match_resize(pim, "assets/images/win_win10.png", 0.8) if loc is not None: x, y = loc moveTo(x, y) print(screen_x, screen_y)