0
#! python3
import pyautogui
import time
pyautogui.screenshot('first.png') #take a SS of my entire screen
check = pyautogui.locateCenterOnScreen('first.png') # set the value of check to center of screen assuming it will be the same as the SS...it will
print(check) #(960, 540) is the center of my screen and is stored in check
while True: #inf loop
pyautogui.screenshot('Test.png') #take a second Screenshot
idleout = pyautogui.locateCenterOnScreen('Test.png') #set the value of idleout with the center of test.jpg
print(idleout) #(960, 540) is the center suprised??
if idleout != check: #idleout != (960, 540) then this should happen
pyautogui.press('space') #space is never pressed or any action taken ive even tried with print("hello")
我想要发生的是如果屏幕截图不匹配什么是我的屏幕上它会做一些行动。 IM在运行油烟这里Python自动化与pyautogui如果语句不会执行
所以要清除它,你完全正确。我错过了缩进,但它从来没有显示错误,因为语法是正确的。谢谢! – John
我很高兴这是修复! – AetherUnbound