← 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

Aravind requested more information:
Hi Raiman,

Sorry to reopen this thread but I have a small doubt regarding the "r.isChanged" in Comment#3.
The same might have turned out to be really helpful for report generation if that r.isChanged worked fine.
Now while running the script, it says
AttributeError: 'Region' object has no attribute 'isChanged'

Here goes the code snippet which I've tried based on your logic:

bigScreenReg = Region(278,155,718,397)
bigScreenReg.highlight(3)
print "Checking bigScreen Video Region"
r = bigScreenReg
r.onChange(100, changed)
r.observe(5,background=False)
Settings.isChanged = False
for i in range(5):
       if r.isChanged:
            print "Something changed"
            Settings.isChanged = False
       else:
            print "Nothing changed" 
r.stopObserver()

And the following is the handler:

def changed(event):
    print "something changed in ", event.region
    for ch in event.changes:
        ch.highlight() # highlight all changes
    sleep(1)
    for ch in event.changes:
        ch.highlight() # turn off the highlights
    Settings.isChanged = True

Or is there any other work around to get the 'Video stopped streaming' message in the report by sticking on with the onChange event handler itself?
 
Thanks a lot Raiman.

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