← Back to team overview

sikuli-driver team mailing list archive

[Question #187104]: Trying to sense when the screen stops changing

 

New question #187104 on Sikuli:
https://answers.launchpad.net/sikuli/+question/187104

I'm trying to setup a script that senses when a region of the screen stops changing...

First I tried:

   spot = Region(100,100,50,50) 
   wait(1)
   while Region(100,100,50,50) <> spot: 
       spot = Region(100,100,50,50)
       wait(1)
   # should get here when the region stops changing

... but it didn't work.  Not sure why not.

So then I tried an observer...

    click(Location(mtx,mty))
    #watch the screen for change... will end when not moving...
    with Region(669,359,216,164) as r:
    # any change in r larger than 25 pixels would trigger the changed function
        onChange(25, changed)
        observe(4,background=False)
    global chgs
    popup("changes = " + str(chgs))
    r.stopObserver()
    wait(1)

But the behavior is that changed is called just once and I'm not sure how to get it to wait/repeat.  

It would be useful if observe() returned FALSE if it timed out... then I could loop until FALSE was returned (meaning no more changes are occurring).

Any suggestions would be most welcome!


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