observe - onChange not working for me!

Asked by Guillermo on 2020-04-28

Hello everyone!

Im trying to do observe - onChange to a region but nothing happens.
Im looking for changes in a game that really changes, but not detected by sikuli.
Im using sikuli 1.1.4 and jython 2.7.1.
SO is Windows 10.

What Im missing???

########################

This is my code:

def changed():
    r.highlightOn()
    wait(FOREVER)

while True:
    r = (Region(440,175,510,390))
    r.onChange(50,changed)
    r.observe(10,background=False)
    r.stopObserver()

#######################

Question information

Language:
English Edit question
Status:
Answered
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Last query:
2020-04-28
Last reply:
2020-04-29
RaiMan (raimund-hocke) said : #1

Try with 2.0.4

Guillermo (wishen) said : #2

Thanks for the answer, already updated to 2.0.4 but still not detecting changes.

Tried in two diferent notebooks, but no solutions.

Is there another way to detect changes? I tried to use capture() inside a loop, but allways is comparing with the first capture(), the image captured is not uptaded in the next loop.

RaiMan (raimund-hocke) said : #3

This worked for me:

reg = selectRegion()

def handler(evt):
    print "changed"
    evt.stopObserver()

reg.onChange(handler)
reg.observe(10)

I select a region in a tabbed editor and then switch the tab, so the region content changes.

Can you help with this problem?

Provide an answer of your own, or ask Guillermo for more information if necessary.

To post a message you must log in.