]> git.saurik.com Git - wxWidgets.git/blob - wxPython/samples/wxPIA_book/Chapter-08/frame_subclass.py
Added the sample code from wxPython In Action to the samples dir
[wxWidgets.git] / wxPython / samples / wxPIA_book / Chapter-08 / frame_subclass.py
1 import wx
2
3 class SubclassFrame(wx.Frame):
4 def __init__(self):
5 wx.Frame.__init__(self, None, -1, 'Frame Subclass',
6 size=(300, 100))
7 panel = wx.Panel(self, -1)
8 button = wx.Button(panel, -1, "Close Me", pos=(15, 15))
9 self.Bind(wx.EVT_BUTTON, self.OnCloseMe, button)
10 self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)
11
12 def OnCloseMe(self, event):
13 self.Close(True)
14
15 def OnCloseWindow(self, event):
16 self.Destroy()
17
18 if __name__ == '__main__':
19 app = wx.PySimpleApp()
20 SubclassFrame().Show()
21 app.MainLoop()