wxPython
hello world
import wx
app = wx.App(False) # Create a new app, don't redirect stdout/stderr to a window.
frame = wx.Frame(None, wx.ID_ANY, "Hello World") # A Frame is a top-level window.
frame.Show(True) # Show the frame.
app.MainLoop()
-
app = wx.App(False)
- 每个wx.App都是一个wxPython的对象
- False意为 不重定向一个stdout和stderr窗口
-
frame = wx.Frame(None,wx.ID_ANY,"Hello World")
-
frame.Show(True)
-
app.MainLoop()
First Step
import wx
class MyFrame(wx.Frame):
""" We simply derive a new class of Frame. """
def __init__(self, parent, title):
wx.Frame.__init__(self, parent, title=title, size=(200,100))
self.control = wx.TextCtrl(self, style=wx.TE_MULTILINE)
self.Show(True)
app = wx.App(False)
frame = MyFrame(None, 'Small editor')
app.MainLoop()