← Back to team overview

sikuli-driver team mailing list archive

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

 

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

So I am fiddling along, reading the docs and getting a better understanding of the commands. Yet what I do miss are basic simple examples to show the structure and syntax of the different commands.

I got the following code: (which works)

def changed(event):

    
        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

r = Region(Region(1058,316,22,23))
# any change in r larger than 250 pixels would trigger the changed function
r.onChange(250, changed)
# another way to observe infinite

r.observeInBackground();wait(FOREVER)

===================

The problem is dat the change event picks up a single change 2 or 3 times within a second. I want to delay it by 4 seconds. That way I am sure that the change only counts for 1 change in 4 seconds.

I looked up the command in the docs:

 repeat([waitTime])

I tryed several places where to put it but it doesnt delay the event. I assume I got some syntax wrong... there is no clear example using this. Anyone can help me? 

Cheers

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