7
|
1 import wx
|
|
2
|
|
3 class MyApp(wx.App):
|
|
4
|
|
5 def OnInit(self):
|
|
6 frame = wx.Frame(None, -1, f_label)
|
|
7 self.n_pressed = 0
|
|
8 label = "Hello! (%d)" %(self.n_pressed)
|
|
9 self.button = wx.Button(frame, -1, label)
|
|
10 self.button.Bind(wx.EVT_BUTTON, self.myButtonHandler)
|
|
11 self.SetTopWindow(frame)
|
|
12 self.frame.Show(True)
|
|
13 return True
|
|
14
|
|
15 def myButtonHandler(self, evt):
|
|
16 self.n_pressed += 1
|
|
17 label = "Hello! (%d)" %(self.n_pressed)
|
|
18 self.button.SetLabel(label)
|
|
19
|
|
20 app = MyApp(0)
|
|
21 app.MainLoop()
|