wxPythonのテンプレート

#!/usr/bin/env python                                                                           
#-*- coding:utf-8 -*-                                                                           

import wx

class MyFrame(wx.Frame):
    def __init__(self,parent,id,title):
        wx.Frame.__init__(self,parent,id,title,wx.DefaultPosition,wx.DefaultSize)

class MyApp(wx.App):
    def OnInit(self):
        frame = MyFrame(None,-1,"template")
        frame.Show()
        return True

app = MyApp(0)
app.MainLoop()
#!/usr/bin/env python
#-*- coding:utf-8 -*-

import wx

class MyFrame(wx.Frame):
    def __init__(self,parent,id,title):
        wx.Frame.__init__(self,parent,id,title,wx.DefaultPosition,wx.DefaultSize)
        panel = wx.Panel(self,-1)
        box = wx.BoxSizer(wx.HORIZONTAL)
        box.Add(wx.Button(panel,1,"button"),1,wx.ALL,5)
        self.text = wx.StaticText(panel,-1,"text")
        box.Add(self.text,1,wx.ALL,5)
        panel.SetSizer(box)
        self.Centre()

        self.Bind(wx.EVT_BUTTON,self.OnPush,id=1)

    def OnPush(self,event):
        self.text.SetLabel("Pushed")

class MyApp(wx.App):
    def OnInit(self):
        frame = MyFrame(None,-1,"template")
        frame.Show()
        return True

app = MyApp(0)
app.MainLoop()