← Back to team overview

sikuli-driver team mailing list archive

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

 

Question #187104 on SikuliX changed:
https://answers.launchpad.net/sikuli/+question/187104

RaiMan posted a new comment:
only to be complete: this worked for me (2.0.5):

class X(unittest.TestCase):

    def changed(self, e):
        print "handler"
        self.changes = e.changes
        e.stopObserver()

    def activity(self):
        self.changes = None
        r = Region(+41,0,230,151)
        r.highlight(3)
        print("Checkpoint 1") #Gets Here
        r.onChange(self.changed)
        print("Checkpoint 2") #Never Gets Here

        while True:
            print "observing"
            retObs = r.observe(5)
            if retObs:
                print "changes:", self.changes
                self.changes = None
                break
            else:
                break
        print "observe returned:", retObs

def PDASuite():
    PDASuite = unittest.TestSuite()
    PDASuite.addTest(X("activity"))
    return PDASuite

unittest.TextTestRunner(verbosity=2).run(PDASuite())

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