How do I get coordinates?
To get coordinates, you have to move the cursor to the point where you want to click after changing the particular coordinate's RGB value and run "pyautogui.position()" to get the x and y coordinates of that pixel.
code:
import pyautogui as py
import keyboard
import win32api,win32con
importtime
time.sleep(5) # wait 5s before starting
def leftclick(x,y):
win32api.SetCursorPos((x,y))
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,0,0)
time.sleep(0.01)
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP,0,0)
while(not keyboard.is_pressed('q')):# wait until 'q' is pressed
if py.pixel(467,440)[0]==0: # compare pixel's RGB value with black color
leftclick(467,440)
if py.pixel(552,440)[0]==0:
leftclick(552,440)
if py.pixel(700,440)[0]==0:
leftclick(700,440);
if py.pixel(821,440)[0]==0:
leftclick(821,440)
:) Happy coding.
![](https://i.ytimg.com/vi/xU8bByV7KOg/maxresdefault.jpg)