python check if colour exists on mouse click
Question: I am trying to automate part of a game. I've done all but one part of what I
need and its proving to be difficult. My code so far:

    
    
    import win32api, win32con, time
    import win32com.client as comclt
    
    counter = 0
    holder = 611
    
    def click(x,y):
        win32api.SetCursorPos((x,y))
        win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,x,y,0,0)
        win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP,x,y,0,0)
    
    click(100,470)#click auto
    time.sleep(1)
    click(336,222)#click private parking
    time.sleep(0.5)
    click(1200,330)#click steal
    time.sleep(1)
    click(429,y)#select car
    

The last line "select car" is where I am having an issue. Basically I cannot
always steal a car because the attempt will fail so I need a way to check if a
car has been stolen. Once you steal a car it gives you some info in a row and
at the end is a colour bar. What I would like to do is this:

After stealing a car, check to see if the colour red exists at x,y
coordinates. If so, do something else (which is already done). If not I will
set the y coord back. What is the best way for me to go about checking whether
the colour red is present?


Answer: solved using: color =
win32gui.GetPixel(win32gui.GetDC(win32gui.GetActiveWindow()), 1242 , 523)

