← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #227960]: How to make sikuli detect motions within a specific region?

 

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

    Status: Answered => Open

Frank Feng is still having a problem:
Thanks, RaiMan.

I was trying to get through some sample code. I need to call sikuli apis
on Jython level. Here are some code:

from sikuli import Sikuli
def changed(event):
    event = Sikuli.SikuliEvent
    print "Something changed in ", event.region
    print event.changes
    print dir(event.changes)
    print help(event.changes)
    for ch in event.changes:
        ch.highlight()
    Sikuli.wait(2)
    for ch in event.changes:
        ch.highlight()

with Sikuli.selectRegion("Select a region") as r:
    Sikuli.onChange(50, changed)
    Sikuli.observe(background=True)

Sikuli.wait(10)
r.stopObserver()

Then I run jython script.py, and tried to select a video playback then
it gave me this error:

None
Exception in thread "Thread-5" Traceback (most recent call last):
  File "C:\Automation_vendor\sikuli\sikuli_windows_32\current\sikuli-script.jar\Lib\sikuli\Region.py", line 287, in observe
  File "C:\Automation_vendor\sikuli\sikuli_windows_32\current\sikuli-script.jar\Lib\sikuli\Region.py", line 277, in targetChanged
  File "Sikuli_app.py", line 17, in changed
    for ch in event.changes:
TypeError: 'reflectedfield' object is not iterable


Can you please help?

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.