import wx
class MyFrame(wx.Frame):
def __init__(self,parent,id,title):
wx.Frame.__init__(self,parent,id,title,wx.DefaultPosition,wx.DefaultSize)
lyrics = ''' push the button1 please '''
self.panel = wx.Panel(self,-1)
box = wx.BoxSizer(wx.HORIZONTAL)
btn1 = wx.Button(self.panel,1,'Button1')
box.Add(btn1, 1,wx.ALL,15)
box.Add(wx.Button(self.panel, 2, 'Button2'), 1,wx.ALL,15)
box.Add(wx.Button(self.panel, 3, 'Button3'), 1,wx.ALL,15)
self.panel.SetSizer(box)
self.text1 = wx.StaticText(self.panel,-1,lyrics, (45,190),style=wx.ALIGN_CENTRE)
self.Centre()
self.Bind(wx.EVT_BUTTON,self.OnButton1,id=1)
self.Bind(wx.EVT_BUTTON,self.OnButton2,id=2)
self.Bind(wx.EVT_BUTTON,self.OnButton3,id=3)
def OnButton1(self,event):
self.text1.SetLabel("button1 was pushed")
def OnButton2(self,event):
self.text1.SetLabel("button2 was pushed")
def OnButton3(self,event):
self.text1.SetLabel("button3 was pushed")
class MyApp(wx.App):
def OnInit(self):
frame = MyFrame(None,-1,"hoge")
frame.Show()
return True
app = MyApp(0)
app.MainLoop()