← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #148363]: unfocus code snipet

 

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

RaiMan posted a new comment:
No, this additional else should give a syntax error.

The <return False> happens in my script, when the loop is finished
(nothing found). If it is found, the function returns from inside the
loop. So there is no else needed.

Again my original script with 4 blanks per indentation level:

def unfocus(obj, sim=0.7, reg=SCREEN):
    to = Location(0,0)
    if obj.__class__.__name__ == "Pattern":
        to = obj.getTargetOffset()
    for i in range(4):
        if reg.exists(Pattern(obj).similar(sim).targetOffset(to.x, to.y),0):
            return reg.getLastMatch()
        sim -= 0.1
    return false

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