jezv 1 年間 前
コミット
2283c0d940
3 ファイル変更45 行追加0 行削除
  1. 1 0
      .gitignore
  2. 44 0
      trex/main.py
  3. BIN
      trex/screenshot.png

+ 1 - 0
.gitignore

@@ -0,0 +1 @@
+lection

+ 44 - 0
trex/main.py

@@ -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()

BIN
trex/screenshot.png