Click on every circle on screen with python

389 views Asked by At

So i'm trying to create a python script that takes a screenshot a few time in a second and locates the orange circles then clicks on them. I'm using for the website https://mouseaccuracy.com to automatically click on every circle very fast. Here is the code i have so far:

import pyautogui
from time import *
color = (235, 133, 0)

while True:

 s = pyautogui.screenshot("screenshottest.png",region=(0,160, 1366, 768))
 for x in range(s.width):
  for y in range(s.height):
    if s.getpixel((x, y)) == color:
        pyautogui.click(x, y+160)  

The problem with this is that it clicks on literally every pixel when i only want to click on every circle instead of every pixel of the circle.

Here is what the circles that it needs to click on look like: circles that need to be clicked

So how do i make it click on every orange circle instead of every orange pixel? thank you in advance

0

There are 0 answers