这是我的代码,它应该检查指定区域中的“black_dot.png”。但它给我的输出是: Box(left=1444, top=635, width=11, height=11) 如果它工作正常,这在物理上应该是不可能的。
import time
import pyautogui
import keyboard
left = 650
top = 500
width = 835
height = 700
def switch_tab():
pyautogui.keyDown("alt")
pyautogui.press("tab")
pyautogui.keyUp("tab")
pyautogui.keyUp("alt")
switch_tab()
time.sleep(0.1)
while True:
image_found = pyautogui.locateOnScreen("Images\\black_dot.png", region=(left, top, width, height))
if image_found:
pyautogui.click(image_found)
break
if image_found:
print(image_found)
else:
print("Image Not Found")
switch_tab()
我尝试更改坐标以查看是否会改变它没有的输出。