← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #323987]: Defined function is looping

 

Question #323987 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/323987

    Status: Open => Answered

masuo proposed the following answer:
This is my sample code for study for onChange.
This might be your help.

Settings.UserLogs = True
Settings.UserLogTime = True
def handler(event):
    global status
    event.stopObserver()
    Debug.user("onChange")
    status = "retry" 

r = Region(91,4,422,69)
r.onChange(handler)
status = "start"
for cnt in range(30):
    r.observe(FOREVER,background=True)
    status = "wait"
    Debug.user("wait onChange")
    while status == "wait":
        wait(1)
    wait(3)

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.