Skip to content Skip to sidebar Skip to footer

How Does Wxpython Exit Mainloop?

I have a wxpython application, it runs this way: if __name__ == '__main__': app = wx.App(False) frame = MainWindow('Application') frame.Show() app.MainLoop() there

Solution 1:

  1. When "exit" is clicked, what happens exactly?

    'exit' has an event binding to call the method onExit which calls the close method of this instance of MainWindow. This invokes an EVT_CLOSE event, you have the option to bind to this and control what happens, if you dont bind, it calls the Destroy method which destroys the window safely.

  2. When "exit" is clicked, what happens to app.MainLoop()?

    The mainloop will continue processeing events unless the last of its top level windows is closed, when this happens the mainlop ends.

  3. Is clicking "X" button on top-right of the frame window same with clicking "exit" button?

    Its kind of the same as it generates a EVT_CLOSE event which has a binding to onExit as above.

  4. Why doesn't python.exe*32 process end when I click "X" button, and how do I kill python.exe*32 process end when I click "X" button?

    It should end when all top level windows are closed, you must still have a top level window in existance.

  5. Why wouldn't it print "ok" when I click "exit" if I run the script this way

    Normally it would when there are no top level windows left.


Post a Comment for "How Does Wxpython Exit Mainloop?"