# _*_ coding: utf-8 _*_
__author__ = 'pythonwu'
__date__ = "2018/5/15 15:05"
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') #输出到stdout
self.frame = Frame(parent=None,id=-1,title='Startup') #创建框架
self.frame.Show()
self.SetTopWindow(self.frame)
# print >> sys.stderr,'A pretend error message' #输出到stderr
print('A pretend error message',file =sys.stderr)
return True
def OnExit(self):
print("OnExit") #窗口消失的太快,无法被屏幕捕获
if __name__ == '__main__':
app = App(redirect=True) #文本重定向从这里开始
print("before MainLoop")
app.MainLoop()
print("after MainLoop")