← Back to team overview

sikuli-driver team mailing list archive

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

 

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

Mychal Miller posted a new comment:
Raiman, I tried putting your code into a function which is inside a
class and it never makes it past "r.onChange(changed)".  I'm certain
that I'm not calling "changed" correctly, but I've tried it a bunch of
ways and none of them seem to work.

When I run the code you posted above as an individual script it runs
fine, but inside of my class/function it doesn't. It reaches the first
checkpoint, but doesn't reach the second checkpoint (see popups in
code).


import unittest
import HTMLTestRunner

class X(unittest.TestCase):

    changes = None

    def changed(self, e):
#        print "**** changed"+str(e.type)+"#"
        global changes
        changes = e.changes

    def activity(self):
        r = Region(324,176,621,526)
        popup("Checkpoint 1")    #Gets Here
        r.onChange(changed(self))
        popup("Checkpoint 2")    #Never Gets Here

        while True:
            r.observe(2)
            if changes:
                print "changes:", str(changes)
                changes = None
            else:
                break

def PDASuite():
    PDASuite = unittest.TestSuite()
    PDASuite.addTest(X("activity"))
    return PDASuite
    
if __name__ == '__main__':
    #unittest.main()
    unittest.TextTestRunner(verbosity=2).run(PDASuite())

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