wxpython: close the frame but no the script
I have a script, this call to a wx.app
when I close the wx.app this close the script, why ?class Frame(wx.Frame):
def _init_ctrls(self, prnt):
...
class BoaApp(wx.App):
def OnInit(self):
开发者_运维知识库 self.main = Frame.create(None)
self.main.Show()
self.SetTopWindow(self.main)
return True
def main():
application = BoaApp(0)
application.MainLoop()
if __name__ == '__main__':
main()
When you call app.MainLoop()
the script goes into a loop which runs the app. When you close the app the loop exits and any code after the call of app.MainLoop()
then executes. If there isn't anything left to do, the script will end.
精彩评论