]>
Commit | Line | Data |
---|---|---|
be05b434 RD |
1 | #!/usr/bin/env python |
2 | ||
3 | import wx | |
4 | ||
5 | class DoubleEventFrame(wx.Frame): | |
6 | ||
7 | def __init__(self, parent, id): | |
8 | wx.Frame.__init__(self, parent, id, 'Frame With Button', | |
9 | size=(300, 100)) | |
10 | self.panel = wx.Panel(self, -1) | |
11 | self.button = wx.Button(self.panel, -1, "Click Me", pos=(100, 15)) | |
12 | self.Bind(wx.EVT_BUTTON, self.OnButtonClick, self.button) | |
13 | self.button.Bind(wx.EVT_LEFT_DOWN, self.OnMouseDown) | |
14 | ||
15 | def OnButtonClick(self, event): | |
16 | self.panel.SetBackgroundColour('Green') | |
17 | self.panel.Refresh() | |
18 | ||
19 | def OnMouseDown(self, event): | |
20 | self.button.SetLabel("Again!") | |
21 | event.Skip() | |
22 | ||
23 | if __name__ == '__main__': | |
24 | app = wx.PySimpleApp() | |
25 | frame = DoubleEventFrame(parent=None, id=-1) | |
26 | frame.Show() | |
27 | app.MainLoop() | |
28 |