]> git.saurik.com Git - wxWidgets.git/blob - wxPython/samples/wxPIA_book/Chapter-10/toggle_items.py
Added the sample code from wxPython In Action to the samples dir
[wxWidgets.git] / wxPython / samples / wxPIA_book / Chapter-10 / toggle_items.py
1 import wx
2
3 class MyFrame(wx.Frame):
4 def __init__(self):
5 wx.Frame.__init__(self, None, -1,
6 "Toggle Items Example")
7 p = wx.Panel(self)
8 menuBar = wx.MenuBar()
9 menu = wx.Menu()
10 exit = menu.Append(-1, "Exit")
11 self.Bind(wx.EVT_MENU, self.OnExit, exit)
12 menuBar.Append(menu, "Menu")
13
14 menu = wx.Menu()
15 menu.AppendCheckItem(-1, "Check Item 1")
16 menu.AppendCheckItem(-1, "Check Item 2")
17 menu.AppendCheckItem(-1, "Check Item 3")
18 menu.AppendSeparator()
19 menu.AppendRadioItem(-1, "Radio Item 1")
20 menu.AppendRadioItem(-1, "Radio Item 2")
21 menu.AppendRadioItem(-1, "Radio Item 3")
22 menuBar.Append(menu, "Toggle Items")
23
24 self.SetMenuBar(menuBar)
25
26 def OnExit(self, event):
27 self.Close()
28
29
30 if __name__ == "__main__":
31 app = wx.PySimpleApp()
32 frame = MyFrame()
33 frame.Show()
34 app.MainLoop()
35
36