活学活用wxPython基础框架

时间:2023-03-08 17:26:48
活学活用wxPython基础框架

看活活用wxpython这本书,基本框架是这样子的,这里有定义输出,然后打印出整个流程,可以看到是怎样执行的,明天请假了,五一回去玩几天,哈哈,估计假期过来都忘了

import wx
import sys class Frame(wx.Frame): def __init__(self,parent,id,title):
print "Frame __init__"
wx.Frame.__init__(self,parent,id,title) class App(wx.App): def __init__(self,redirect=True,filename=None):
print "App __init__"
wx.App.__init__(self,redirect,filename) def OnInit(self):
print "OnInit"
self.frame = Frame(parent=None, id = -1, title="StartUp")
self.frame.Show()
self.SetTopWindow(self.frame)
print sys.stderr,"A pretend error message"
return True def OnExit(self):s
print "OnExit" if __name__ == "__main__":
app = App(True,"output")
print "Before MainLoop"
app.MainLoop()
print "After MainLoop"