Anonim_999

buttonFinder

Jan 22nd, 2023
1,258
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.46 KB | None | 0 0
  1. import keyboard as key
  2. import pyautogui
  3. import keyboard
  4. import time
  5. import random
  6.  
  7. def checkButton():
  8.     buttonlocation = pyautogui.locateOnScreen('button.png')
  9.     if buttonlocation is None:
  10.         pass
  11.     else:
  12.         print('is found')
  13.         buttonx, buttony = pyautogui.locateCenterOnScreen('button.png')
  14.         pyautogui.click(buttonx,buttony)
  15.         time.sleep(0.2)
  16.         pyautogui.click(buttonx,buttony)
  17.         print('x:' + str(buttonx) + ' y:' + str(buttony))
  18.  
  19. while True:
  20.     checkButton()
  21.  
Advertisement
Add Comment
Please, Sign In to add comment