]> git.saurik.com Git - wxWidgets.git/blob - wxPython/samples/wxPIA_book/Chapter-10/create_simple_menu.py
fix typo
[wxWidgets.git] / wxPython / samples / wxPIA_book / Chapter-10 / create_simple_menu.py
1 import wx
2
3 class MyFrame(wx.Frame):
4 def __init__(self):
5 wx.Frame.__init__(self, None, -1, "Simple Menu Example")
6 p = wx.Panel(self)
7 menu = wx.Menu()
8 simple = menu.Append(-1, "Simple menu item")
9 menu.AppendSeparator()
10 exit = menu.Append(-1, "Exit")
11 self.Bind(wx.EVT_MENU, self.OnSimple, simple)
12 self.Bind(wx.EVT_MENU, self.OnExit, exit)
13 menuBar = wx.MenuBar()
14 menuBar.Append(menu, "Simple Menu")
15 self.SetMenuBar(menuBar)
16
17 def OnSimple(self, event):
18 wx.MessageBox("You selected the simple menu item")
19
20 def OnExit(self, event):
21 self.Close()
22
23 if __name__ == "__main__":
24 app = wx.PySimpleApp()
25 frame = MyFrame()
26 frame.Show()
27 app.MainLoop()
28
29