Untitled
unknown
plain_text
10 months ago
983 B
11
Indexable
from PIL import ImageGrab, Image, ImageChops
from pyautogui import press, typewrite, hotkey
import time
import datetime
if __name__ == '__main__':
battle_width = 160
battle_height = 160
start_x = 0 #3255
start_y = 0 #820
files = [None, None]
file_names = ["a.jpg", "b.jpg"]
i = 0
while True:
file = ImageGrab.grab(bbox=(start_x, start_y, start_x + 160, start_y + battle_height))
files[i % 2] = file
file_name = file_names[i % 2]
file.save(file_name)
i += 1
i = i % 2
if files[i] is not None:
diff = ImageChops.difference(file, files[i])
if diff.getbbox():
hotkey("ctrl", "q")
print("images are different - " + datetime.datetime.fromtimestamp(time.time()).strftime('%Y-%m-%d %H:%M:%S'))
break
else:
print("images are the same")
time.sleep(1)
Editor is loading...
Leave a Comment