← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #183431]: onChange runs without happening any change

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
# --- caller.sikuli

import doubleClicker #---1

def caller():
    doubleClicker.A()

caller()


# --- doubleClicker.sikuli

def pop(event):
   doubleClick("firefoxIcon")
   event.region.stopObserver() #---2

def A():
 reg =Region(761,14,605,422)
 reg.onChange(pop) #---3
 reg.observe(20)

#---1 import should not be in a def()

#---2 if you want to stop the observation after the first detected
change

#---3 normally a change of a square containing 50 pixel ( 7 x 7 pixels )
triggers a change event. This is a good value to detect even small
changes that make sense. (your 1 as 1st parameter triggers with 1 pixel
out of about 255.000 ;-)

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