Sikuli: onAppear works regardless of the pattern presence

891 Views Asked by At

As far as I understand onAppear is to evoke the handler in case the Pattern is on the screen.
However, when I'm running:

paste(Pattern("123.png").targetOffset(-1,37),"testText")
wait(2)
onAppear("456.png", popup("Text1"))

Pop-up appears always, even if the pattern 456.png is not on the screen

Could you please advise, what I'm missing?

1

There are 1 best solutions below

0
On BEST ANSWER

You're missing the observer call. You can read more on observers in sikuli here

Basically what you need to do is add the following line after your code:

observe([your desired timeout in seconds], [background = True/False])

And don't forget to add the stopObserver() call if you don't set timeout.