← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #258197]: [1.1.0] Using observe to continuously look for pattern and take actions

 

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

Shafiq Khan posted a new comment:
Thank you RaiMan. I was actually putting "event.repeat(FOREVER)" and IDE
was giving me error. But this cleared things up.

You said there can be only one observer per region. So if I wanted to
observe two things in two different regions of the screen more
efficiently, would this be the right thing to do:

def reactToDisconnect():
    #clicks any 'x' or 'OK' button to close disconnect error popups

def xButtonObserver():
    regUpperHalf.onAppear(xButton, reactToDisconnect())
    observe(FOREVER,background=True)
    regUpperHalf.repeat()

def okButtonObserver():
    regLowerHalf.onAppear(okButton, reactToDisconnect())
    observe(FOREVER,background=True)
    regUpperHalf.repeat()

xButtonObserver() #Observing for x on upper half of the screen
okButtonObserver() #Observing for OK on lower half of the screen
mainScript()

Or would it be better to enlarge the region to some middle 2/3rd and use
only that region twice?

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