← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #259577]: Is there a way to discard the background while image compareing

 

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

Eugene Maslov proposed the following answer:
@Anunaya

If the icons are semi-transparent, so that cropping doesn't help, it's still possible to make several screenshots of the icons for each background and send it to a function selecting the best of them.
I mostly use this way for blinking buttons, which change their color with time.

It can be like that:

def findAny(thelist, theregion=SCREEN, timeout=False):
    if not timeout:
        timeout=theregion.getAutoWaitTimeout()
    res=None
    i=0
    for s in thelist:
        if i==0:
            t=timeout
        else:
            t=0
        found=theregion.exists(s,t)
        i+=1
        if found:
            res=found
            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.