我试图让pyautogui读取一个chrome窗口,并根据某个像素的颜色创建一个windows警报。当chrome是上面的窗口时,我已经让它工作了,但是当chrome在其他窗口后面,或者可能在第二个桌面上时,我需要它工作。我更希望我能用pyautogui来实现这一点,但我愿意学习其他库。这是我的密码:
from win10toast import ToastNotifier
import time
import pyautogui
toaster = ToastNotifier()
print("Started")
def reload():
pyautogui.click(108,62)
print("reload")
def alert():
print("reading screen")
im = pyautogui.screenshot()
if im.getpixel((495,916)) != (255, 255, 255):
toaster.show_toast("Crowdtap",
"You have a new crowdtap opportunity.",
duration=10)
else:
toaster.show_toast("Nope", "no", duration = 10)
while True:
alert()
time.sleep(180)
reload()
time.sleep(60)
目前没有回答
相关问题 更多 >
编程相关推荐