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