]> git.saurik.com Git - wxWidgets.git/blob - wxPython/samples/wxPIA_book/Chapter-10/sub_menu.py
don't use strlen() to verify the length of the string as it can contain embedded...
[wxWidgets.git] / wxPython / samples / wxPIA_book / Chapter-10 / sub_menu.py
1 import wx
2
3 class MyFrame(wx.Frame):
4 def __init__(self):
5 wx.Frame.__init__(self, None, -1,
6 "Sub-menu Example")
7 p = wx.Panel(self)
8 menu = wx.Menu()
9
10 submenu = wx.Menu()
11 submenu.Append(-1, "Sub-item 1")
12 submenu.Append(-1, "Sub-item 2")
13 menu.AppendMenu(-1, "Sub-menu", submenu)
14
15 menu.AppendSeparator()
16 exit = menu.Append(-1, "Exit")
17 self.Bind(wx.EVT_MENU, self.OnExit, exit)
18
19 menuBar = wx.MenuBar()
20 menuBar.Append(menu, "Menu")
21 self.SetMenuBar(menuBar)
22
23
24 def OnExit(self, event):
25 self.Close()
26
27
28 if __name__ == "__main__":
29 app = wx.PySimpleApp()
30 frame = MyFrame()
31 frame.Show()
32 app.MainLoop()
33
34