import pyautogui
im=pyautogui.screenshot()
a=im.getpixel((511,1002))
print(a)
print(pyautogui.pixelMatchesColor(511,1002,(255,220,0)))
import pyautogui
import time
im=pyautogui.screenshot()
a=im.getpixel((578,387))
print(a)
b=im.getpixel((511,1002))
print(b)
c=0
while b!=(255, 220, 0):
time.sleep(1)
c=c+1
print(c)
b=pyautogui.screenshot().getpixel((511,1002))
print(b)
#pyautogui.pixelMatchesColor不稳定,原因不明
print(pyautogui.pixelMatchesColor(511,1002,(255,220,0)))
运行结果: