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

Please advise how I can properly write this better. It seems to be working but 
after a few min. The script seems to sit idle.
I don't even think the observer is stopping correctly. 

I'm monitoring a specified region for changes (lots of movement in that region) 
and when it's found, clicks that region then continues with the script. 

Here's what I have:

def boxObserve():
    def changed(event):
      event.stopObserver()  
      sleep(0.15)
      box.stopObserver()
      for chg in event.changes:
        box.stopObserver()  
        sleep(0.25)
        event.changes[-1].click() #click on the last changed agrea
      doSomethingAfterClicking() #Do this after clicking    
    box = Region(684,552,266,371)
    box.onChange(500, changed)
    box.observe(0.5,background=False)
    sleep(0.25)
    box.stopObserver()
    doSomethingIfNothingChanged() #Do this function if Observer didnt detect 
any changes.

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

_______________________________________________
Mailing list: https://launchpad.net/~sikuli-driver
Post to     : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp

Reply via email to