]> git.saurik.com Git - wxWidgets.git/blob - wxPython/samples/wxPIA_book/Chapter-03/menu_event.py
don't use strlen() to verify the length of the string as it can contain embedded...
[wxWidgets.git] / wxPython / samples / wxPIA_book / Chapter-03 / menu_event.py
1 #!/usr/bin/env python
2
3 import wx
4
5 class 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
19 if __name__ == '__main__':
20 app = wx.PySimpleApp()
21 frame = MenuEventFrame(parent=None, id=-1)
22 frame.Show()
23 app.MainLoop()
24