一直没有时间,也可能说是懒,所以一直没搞wxPython,现在来弄一下,弄成这个样子,应该是能完成一些事情了:
import wx class myApp(wx.App): def OnInit(self): return True; class myFrame(wx.Frame): def btn1_OnClick(self,event): retCode = wx.MessageBox("You clicked the button","tip",wx.OK) def btn2_OnClick(self,event): self.tmsg.SetLabel("the text is changed") def __init__(self): wx.Frame.__init__(self,None,-1,"hello wxPython",\ size = (400,300)) panel = wx.Panel(self,-1) self.tmsg = wx.StaticText(panel,-1,"this is an example of static text",pos=(100,10)) self.btn1 = wx.Button(panel,-1,"hello",pos =(50,100)) self.btn2 = wx.Button(panel,-1,"change text",pos =(50,200)) self.Bind(wx.EVT_BUTTON,self.btn1_OnClick,self.btn1) self.Bind(wx.EVT_BUTTON,self.btn2_OnClick,self.btn2) if __name__ == '__main__': app = myApp() frame = myFrame() frame.Show() app.MainLoop()