]> git.saurik.com Git - wxWidgets.git/blame_incremental - wxPython/samples/wxPIA_book/Chapter-03/menu_event.py
Added the sample code from wxPython In Action to the samples dir
[wxWidgets.git] / wxPython / samples / wxPIA_book / Chapter-03 / menu_event.py
... / ...
CommitLineData
1#!/usr/bin/env python
2
3import wx
4
5class MenuEventFrame(wx.Frame):
6
7 def __init__(self, parent, id):
8 wx.Frame.__init__(self, parent, id, 'Menus', size=(300, 200))
9 menuBar = wx.MenuBar()
10 menu1 = wx.Menu()
11 menuItem = menu1.Append(-1, "&Exit...")
12 menuBar.Append(menu1, "&File")
13 self.SetMenuBar(menuBar)
14 self.Bind(wx.EVT_MENU, self.OnCloseMe, menuItem)
15
16 def OnCloseMe(self, event):
17 self.Close(True)
18
19if __name__ == '__main__':
20 app = wx.PySimpleApp()
21 frame = MenuEventFrame(parent=None, id=-1)
22 frame.Show()
23 app.MainLoop()
24