← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #245266]: [error] NameError (name 'onEvent' is not defined)

 

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

    Status: Open => Answered

Carl proposed the following answer:
I am pretty new at this so this may be a bit of a kludge, but maybe something like this: 
    #Set screen regions to improve search speed somewhat. Divide into halfs and quarters.     
    #TopHalf, LowerHalf, LeftHalf, RightHalf, TLQuarter, TRQuarter, BLQuarter, BRQuarter
    
    x = getX()
    y = getY()
    w = getW()
    h = getH()

    rTopHalf = Region(x,y,w,h/2)
    rTopHalf.highlight(1)
    rLowerHalf = Region(x,h/2,w,h/2)
    rLowerHalf.highlight(1)
    rLeftHalf = Region(x,y,w/2,h)
    rLeftHalf.highlight(1)
    rRightHalf = Region(w/2,y,w,h)
    rRightHalf.highlight(1)
    rTLQtr = Region(x,y,w/2,h/2)
    rTLQtr.highlight(1)
    rTRQtr = Region(w/2,y,w/2,h/2)
    rTRQtr.highlight(1)
    rBLQtr = Region(x,h/2,w/2,h/2)
    rBLQtr.highlight(1)
    rBRQtr = Region(w/2,h/2,w/2,h/2)
    rBRQtr.highlight(1)
    
    if not rTRQ.exists(yourseach.png):
        popup("Something not found")
        doAction
    else:
        popup("Something Found")
        doOtherAction

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