开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜