Using onAppear

Asked by Mark McGuinn on 2019-12-01

In version 2.0.1 I am trying to use the onAppear function to catch when a specific piece of text appears. Below is the code I am using, it simple click a button which causes the image to change. The expected image is within five clicks of the button but the onAppear does not see it and the next click happens which takes away the text I am looking for.I have trued passing the text as a constant, as a variable and as shown in the code as an image. None worked.

def changed(event):
    print("Found It")

regmake.onAppear( "1575203969807.png",changed)

for step in range(5):

Question information

English Edit question
Sikuli Edit question
No assignee Edit question
Last query:
Last reply:
Mark McGuinn (mmcguinn) said : #1

I have been experimenting with this and despite using the IDE tool to define a region I am getting the following in the error messages:

error] Region: observe: Nothing to observe (Region might be invalid): R[541,309 597x407]@S(0)

This is the code I am currently using, am I doing something wrong with the way I am calling this function?

modelarea = Region(541,309,597,407)

# while not (findWord(modelname) or findWord("ANY")):
print modelname

def changed(event):
    print("Found It")


modelarea.onAppear( "1575203969807.png",changed)

for step in range(5):

Launchpad Janitor (janitor) said : #2

This question was expired because it remained in the 'Open' state without activity for the last 15 days.