所以我有一个程序,可以向下滚动,直到它可以找到屏幕上的所有图片。这是我的代码:
def scrolluntil():
allsat = False
while allsat == False:
pyautogui.scroll(-100)
fan = locateCenterOnScreen("findaname.png")
tl = locateCenterOnScreen("topleft.png")
tr = locateCenterOnScreen("topright.png")
if fan is not None:
if tl is not None:
if tr is not None:
allsat = True
它一直向下滚动,即使屏幕上有图像也不会停止,因为图像是正确的
我认为你需要为你想找到的每一件东西设置一个标志。按照现在编写代码的方式,
allsat=True
只会在同时查看所有图片时执行这是一种粗糙的方法:
另外值得注意的是,如果您升级了
pyautogui
的版本,您可能需要更新代码才能使用try…except块。从docs开始:相关问题 更多 >
编程相关推荐