Advertisement
Guest User

Untitled

a guest
Nov 13th, 2019
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.62 KB | None | 0 0
  1. from PIL import ImageGrab, ImageOps
  2. import pyautogui
  3. from numpy import *
  4. import time
  5.  
  6.  
  7. class Coordinates():
  8.     replayBtn = (800, 666)
  9.  
  10. def Restart():
  11.     pyautogui.click(Coordinates.replayBtn)
  12.  
  13. def imageGrab():
  14.     box = (800,666,820,680)
  15.     image = ImageGrab.grab(box)
  16.     grayImage = ImageOps.grayscale(image)
  17.     arr = array(grayImage.getcolors())
  18.     print(arr.sum())
  19.  
  20. def main():
  21.     x=0
  22.     while True:
  23.         if imageGrab()==456:
  24.             Restart()
  25.             time.sleep(0.5)
  26.             x=x+1
  27.             print("Restarted ",x," times")
  28.         else:
  29.             time.sleep(3)
  30. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement