PyAutoGUI 如何定义颜色范围
PyAutoGUI how to define color range
如何在 PyAutoGUI 中定义颜色范围?
我的代码看起来像这样
for i in range(loop):
if (pyautogui.pixelMatchesColor(782, 435, (110, 78, 59))):
continue
elif (pyautogui.pixelMatchesColor(782, 435, (color range here))):
continue
else:
pyautogui.click(x=782, y=435)
如果 110、78、59 为假且颜色范围为假,我希望它点击
您可以使用 tolerance
参数。
for i in range(loop):
if not (pyautogui.pixelMatchesColor(782, 435, (110, 78, 59), tolerance = 10)):
pyautogui.click(x=782, y=435)
tolerance
参数指定允许颜色的 rgb-values 与传递给函数的 rgb-values 有多少差异。
如何在 PyAutoGUI 中定义颜色范围? 我的代码看起来像这样
for i in range(loop):
if (pyautogui.pixelMatchesColor(782, 435, (110, 78, 59))):
continue
elif (pyautogui.pixelMatchesColor(782, 435, (color range here))):
continue
else:
pyautogui.click(x=782, y=435)
如果 110、78、59 为假且颜色范围为假,我希望它点击
您可以使用 tolerance
参数。
for i in range(loop):
if not (pyautogui.pixelMatchesColor(782, 435, (110, 78, 59), tolerance = 10)):
pyautogui.click(x=782, y=435)
tolerance
参数指定允许颜色的 rgb-values 与传递给函数的 rgb-values 有多少差异。