← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #246342]: Do onAppear and observe work? [1.0.1]

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
this works as it should:

def handler(e):
    print "in handler"
    e.match.highlight(2)
reg = Region(0,0,300,300)
reg.highlight(2)
img = "1396352710122.png"
reg.onAppear(img, handler)
reg.observe(8, True) 
wait(10)
reg.stopObserver()

img is an image, that is visible in the given region and can be made
visible/invisible by simply activating the right window.

observe in 1.0.1 surely has some quirks, is not debuggable and background observations are not stopped at scripted in IDE.
So to avoid any problems: when running in the IDE one should assure, that all observations are stopped before rerunning the script (therefor the reg.stopObserver()).

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