#----------------------------------------------------------------------
-# A very simple wxPython example. Just a wxFrame, wxPanel,
-# wxStaticText, wxButton, and a wxBoxSizer, but it shows the basic
+# A very simple wxPython example. Just a wx.Frame, wx.Panel,
+# wx.StaticText, wx.Button, and a wx.BoxSizer, but it shows the basic
# structure of any wxPython application.
#----------------------------------------------------------------------
and has a simple menu.
"""
def __init__(self, parent, title):
- wx.Frame.__init__(self, parent, -1, title, size=(350, 200))
+ wx.Frame.__init__(self, parent, -1, title,
+ pos=(150, 150), size=(350, 200))
# Create the menubar
menuBar = wx.MenuBar()
print "Having fun yet?"
-app = wx.PySimpleApp()
-frame = MyFrame(None, "Simple wxPython App")
-frame.Show(True)
+class MyApp(wx.App):
+ def OnInit(self):
+ frame = MyFrame(None, "Simple wxPython App")
+ self.SetTopWindow(frame)
+
+ print "Print statements go to this stdout window by default."
+
+ frame.Show(True)
+ return True
+
+app = MyApp(redirect=True)
app.MainLoop()