← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #685286]: Sikuli Doc - Example code returns error

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
not sure, what happened on your side.

this works as expected:

def changed(event):
  print "something changed ", len(event.changes)
  event.stopObserver()
  for chg in event.changes:
    chg.highlight()
  wait(2)
  for chg in event.changes:
    chg.highlight()
  print "click first"
  for chg in event.changes:
    chg.click()
    break
  print "click last"  
  event.changes[-1].click()

img = "img.png"
m = find(img).grow(0, 150, 0, 0).below(200)
m.highlight(1)
m.onChange(10, changed)
m.observe(10)

I am taking care that 2 changes are detected - the print

[debug] Observer: changes: 2 in: R[46,121 258x200]@S(0)
[debug] Observer: running call back
something changed  2
[debug] Region: observe: request to stop observer for R[46,121 258x200]@S(0)
[debug] highlight M[102,153 14x8]On(0) S 10000 for 0.0 secs
[debug] highlight M[46,121 257x199]On(0) S 10000 for 0.0 secs
click first
[debug] CLICK on L[109,157]@S(0) (529 msec)
click last
[debug] CLICK on L[174,220]@S(0) (531 msec)
[debug] Observer: update result: Changes: true
[debug] Region: observe: ended successfully: R[46,121 258x200]@S(0)

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