Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from PIL import ImageGrab, ImageOps
- import pyautogui
- from numpy import *
- import time
- class Coordinates():
- replayBtn = (800, 666)
- def Restart():
- pyautogui.click(Coordinates.replayBtn)
- def imageGrab():
- box = (800,666,820,680)
- image = ImageGrab.grab(box)
- grayImage = ImageOps.grayscale(image)
- arr = array(grayImage.getcolors())
- print(arr.sum())
- def main():
- x=0
- while True:
- if imageGrab()==456:
- Restart()
- time.sleep(0.5)
- x=x+1
- print("Restarted ",x," times")
- else:
- time.sleep(3)
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement