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

Eugene Maslov proposed the following answer:
Sorry, this corrected function processes second image in the list
quicker. Please discard the code in the answer #2.

import time

def findAny(thelist, theregion=SCREEN, timeout=False):
    if not timeout:
        timeout=theregion.getAutoWaitTimeout()
    res=None
    start_time=time.time()
    exit_time=start_time+timeout
    while time.time()<=exit_time:
        for s in thelist:
            found=theregion.exists(s,0)
            if found:
                res=found
                break
        if res:
            break
    return res    


#usage:
thereg=Region(324,321,648,429)
findAny(["btn_bg1.png","btn_bg2.png","btn_bg3.png"], thereg,timeout=20).click()

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

_______________________________________________
Mailing list: https://launchpad.net/~sikuli-driver
Post to     : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp

Reply via email to