def setApp(self, app):
        """Call this first of all and every time you change
        your application object (like in some testing programs)
        It makes the app subscribe to our special events so that it can
        call your callback functions.
        """
        if app is not self.app:
            if self.app:
                self.app.Disconnect(1, 1, wxEVT_RESPONSE, self._runResponse)
            self.app = app
            self.app.Connect(1, 1, wxEVT_RESPONSE, self._runResponse)
Call this first of all and every time you change
        your application object (like in some testing programs)
        It makes the app subscribe to our special events so that it can
        call your callback functions.
        
recipes/Python/286201_wx_twisted_support_using_threads/recipe-286201.py