← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #680137]: repeat([waitTime]) how is this syntax with a region onchange?

 

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

    Status: Answered => Open

MP is still having a problem:
1) "at beginning of handler just wait 3 seconds and then make your
compare/find logic on event.getRegion()." Well isnt this the part that
just doesnt work? I tryed it with the next code. Did I do something
wrong? It still gives me the double notification+ 2 times the red border
when tested on animation that lasted 3 seconds.

========================================================
def changed(event):
        wait(3)
        print "something changed in ", event.region
        for ch in event.getChanges():
                ch.highlight() # highlight all changes
        wait(1)
        for ch in event.getChanges():
                ch.highlight() # turn off the highlights

Settings.ObserveScanRate = 0.2

r = Region(Region(1056,314,27,27))
# any change in r larger than 50 pixels would trigger the changed function
r.onChange(50, changed)

# another way to observe for 30 seconds
r.observeInBackground();wait(FOREVER)
=====================================================


2) findAny(), I cant find it in your documentation. Can you show me simple example with observer, region and get any ? For example I have IMAGE1, IMAGE2, IMAGE3 and I want to match the appearing number. When it matches with IMAGES1 => print "image1 appeared!", etc

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.