分类: Python/Ruby
2013-12-19 21:30:27
import wx
import sys
class Frame(wx.Frame):
"""Frame class that displays an image"""
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()
print sys.stderr,"A pretend error message"
return True
def OnExit(self):
print "OnExit"
def main():
app = App(redirect=False)#1
print "before MailLoop"
app.MainLoop()#2
print "after MainLoop"
if __name__=="__main__":
main()
App __init__
OnInit
Frame __init__
before MailLoop
OnExit
after MainLoop