← Back to team overview

sikuli-driver team mailing list archive

[Question #187435]: Can't get onChange event handler to run

 

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

    static void FindTXDevMenuRegion()
    throws FindFailed{
        // sub menus of the main menu all appear within a certain region
        // we'll monitor this region for changes
        subMenusRegion = ideMainMenuR.below(500);
        subMenusRegion.highlight(4);

        // register change observer to be triggered when the TXDev menu appears...
        subMenusRegion.onChange(new SikuliEventObserver(){
            public void targetChanged(ChangeEvent evnt) {
                scrpt.popup("targetChanged called");
                for (Match m : evnt.changes) {
                    m.highlight(5);
                }
                subMenusRegion.stopObserver();
            }

            public void targetAppeared(AppearEvent e) {
                scrpt.popup("targetAppeared called");
                ;
            }

            public void targetVanished(VanishEvent e) {
                scrpt.popup("targetVanished called");
                ;
            }
        } );

        // start the observation...
        subMenusRegion.observeInBackground(10);


        // click the menu...
        ideMainMenu_SearchM.click(ideMainMenu_TXDevM.getTarget());

    }


    public static void main(String[] args)
            throws InterruptedException,
            java.awt.AWTException,
            org.sikuli.script.FindFailed{

        scrpt = new SikuliScript();
        scrn = new Screen();

blah blah blah...!


        FindTXDevMenuRegion();


blah blah blah...!


When I run it....


Exception in thread "Thread-2" Traceback (most recent call last):
  File "/Applications/Sikuli-IDE.app/Contents/Resources/Java/sikuli-script.jar/Lib/sikuli/Region.py", line 287, in observe
  File "/Applications/Sikuli-IDE.app/Contents/Resources/Java/sikuli-script.jar/Lib/sikuli/Region.py", line 277, in targetChanged
TypeError: 'TestSikuli$1' object is not callable

Really appreciate your help, thx, Terry.


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