When the last top-level window in your application is closed by the user, the wxPython application exits. By top-level, we mean any frame without a parent, and not just the frame designated using the SetTopWindow() method. This includes any frames created by wxPython itself. For instance, in listing 2.1, the application does not exit until both the main frame and the output redirection frame are closed, even though only the main frame is registered using SetTop-Window(), and even though the application doesn't explicitly create the output redirect frame. To trigger a shutdown programatically, you can call Close() on all top-level windows.
Was this article helpful?