← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #252666]: Observing a region does nothing

 

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

RaiMan posted a new comment:
a simple replacement for the the inline observe is the following:

def myObserve(region, image, wait):
    if not region: region = SCREEN
    start = time.time()
    end = start + wait
    found = True 
    while not region.exists(image, 0):
        if time.time() > end:
            found = False
            break
        wait(1)
    return found

if not myObserve(some_region, some_image, 100):
    print some_image, "did not appear"
    exit(1) # or whatever you want to do here
# do what should be done if image appeared 

even the background observe can be replaced similarly using threading.

BTW: with version 1.1.0 the observe definitely works and has some more
options.

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.