← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #662733]: stop a reg.observeInBackground(FOREVER) whitout event happening

 

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

    Status: Answered => Solved

juan confirmed that the question is solved:
### example
def test(event):
    SCREEN.mouseMove(event.match)
SCREEN.onAppear("1515531321687.png",test)
SCREEN.observeInBackground(FOREVER)
if SCREEN.isObserving():
    popup("is observing")
else:
    popup("is not observing")
SCREEN.stopObserver()
if SCREEN.isObserving():
    popup("is observing")
else:
    popup("is not observing")
while True:
   sleep(1)
###

With your example, I have created this other example, which has allowed me to solve my problem.
in my example if the image is on the screen when I run the script, move the mouse over the image and then show the popups, first is observing, second is not observing.
but if the image is not yet on the screen, it shows the popups, first is observing, second is not observing. If you show the image later, do not move the mouse.
in the first case the event is triggered before it can be stopped, when the image is already visible at the moment of starting the script, which is how it works.
I've tried it on my pc at home, which I have version 1.1.2 and it works fine.
in version 1.1.1 that I have at work (without internet to update) it does not work. I have to update it to version 1.1.2

thank you very much for your help.

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