]>
Commit | Line | Data |
---|---|---|
be05b434 RD |
1 | #!/usr/bin/env python |
2 | ||
3 | import wx | |
4 | ||
5 | class InsertFrame(wx.Frame): | |
6 | ||
7 | def __init__(self, parent, id): | |
8 | wx.Frame.__init__(self, parent, id, 'Frame With Button', | |
9 | size=(300, 100)) | |
10 | panel = wx.Panel(self) | |
11 | button = wx.Button(panel, label="Close", pos=(125, 10), | |
12 | size=(50, 50)) | |
13 | self.Bind(wx.EVT_BUTTON, self.OnCloseMe, button) | |
14 | self.Bind(wx.EVT_CLOSE, self.OnCloseWindow) | |
15 | ||
16 | def OnCloseMe(self, event): | |
17 | self.Close(True) | |
18 | ||
19 | def OnCloseWindow(self, event): | |
20 | self.Destroy() | |
21 | ||
22 | if __name__ == '__main__': | |
23 | app = wx.PySimpleApp() | |
24 | frame = InsertFrame(parent=None, id=-1) | |
25 | frame.Show() | |
26 | app.MainLoop() | |
27 |