|
@@ -0,0 +1,44 @@
|
|
|
+import webbrowser
|
|
|
+from mss import mss
|
|
|
+import numpy as np
|
|
|
+from pathlib import Path
|
|
|
+import matplotlib.pyplot as plt
|
|
|
+from time import sleep
|
|
|
+import pyautogui as gui
|
|
|
+
|
|
|
+webbrowser.open('https://chromedino.com/')
|
|
|
+
|
|
|
+with mss() as sct:
|
|
|
+
|
|
|
+ # Загрузка динозаврика
|
|
|
+ path = Path(Path.cwd(), 'trex', 'screenshot.png')
|
|
|
+ print(path)
|
|
|
+ sct.shot(output='trex/screenshot.png')
|
|
|
+ cur_img = plt.imread(path)
|
|
|
+ sleep(1)
|
|
|
+ sct.shot(output='trex/screenshot.png')
|
|
|
+ next_img = plt.imread(path)
|
|
|
+ time = 0
|
|
|
+ while not np.all(cur_img == next_img):
|
|
|
+ time += 1
|
|
|
+ sleep(1)
|
|
|
+ cur_img = next_img
|
|
|
+ sct.shot(output='trex/screenshot.png')
|
|
|
+ next_img = plt.imread(path)
|
|
|
+ print(f'loaded for {time} sec')
|
|
|
+
|
|
|
+
|
|
|
+ gui.press('f11')
|
|
|
+ sleep(0.1)
|
|
|
+ sct.shot(output='trex/screenshot.png')
|
|
|
+ cur_img = plt.imread(path)
|
|
|
+ with gui.hold('space'):
|
|
|
+ sleep(0.1)
|
|
|
+ sleep(0.2)
|
|
|
+ sct.shot(output='trex/screenshot.png')
|
|
|
+ next_img = plt.imread(path)
|
|
|
+
|
|
|
+ dif = np.sum(np.abs(next_img[0] - cur_img[0]))
|
|
|
+
|
|
|
+ plt.imshow(dif)
|
|
|
+ plt.show()
|