← 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:
He is still giving me twice a red border indicating changes on that
location. But I think I know the problem: I need to delay the screenshot
making of the onchange event by 2 seconds.  After that he can make a
screenshot of that location.

I tryed to type "wait 2" in the event but didnt work. So I assume you
have to put the delay somewhere at the observe event ?

def changed(event):

        wait(2)
        print "something changed in ", event.region
        for ch in event.getChanges():
                ch.highlight() # highlight all changes
        wait(2)
        for ch in event.getChanges():
                ch.highlight() # turn off the highlights
        
        event.repeat(5)

r = Region(Region(1056,312,26,30))
# 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)

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