sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #51095
Re: [Question #679532]: How to stop waiting in main script by observer handler
Question #679532 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/679532
Status: Open => Answered
RaiMan proposed the following answer:
solution: use a global variable
***
def ErrorHandler(event):
global shouldStop
print("Error found")
shouldStop = True
shouldStop = False
While True:
if shouldStop: break
try:
onAppear("error.png",ErrorHandler)
observe(300,background = True) #set observer
wait("1.png",300) #up to 5 min waiting
click("1.png")
except FindFailed:
print("cant find image")
***
... mind the indents ;-)
--
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.