]> git.saurik.com Git - wxWidgets.git/blob - wxPython/tests/menu_replace.py
added wxGetDiskSpace for Win/Unix
[wxWidgets.git] / wxPython / tests / menu_replace.py
1
2 from wxPython.wx import *
3
4 class MainWindowFrame(wxFrame):
5
6 def __init__(self, parentframe, title):
7
8 wxFrame.__init__(self, parentframe, -1,
9 title, size=wxSize(500, 200))
10
11 self.mb = wxMenuBar()
12 self.SetMenuBar(self.mb)
13 self.sbut = wxButton(self, -1,
14 'switch menu (push twice and then use menu)')
15 EVT_BUTTON(self, self.sbut.GetId(), self.switch)
16
17 #help menu
18 self.helpmenu = wxMenu()
19 self.othermenu = wxMenu()
20
21 self.mb.Append(self.helpmenu, '&Help')
22
23
24 def switch(self, event):
25
26 lastmenu = self.mb.GetMenuCount() - 1
27 self.mb.Replace(lastmenu, self.othermenu, 'Other')
28
29
30
31 class TheApp(wxApp):
32
33 def OnInit(self):
34
35 mainwin = MainWindowFrame(NULL, 'menutest')
36 mainwin.Show(true)
37 self.SetTopWindow(mainwin)
38 return true
39
40 app = TheApp(0)
41 app.MainLoop()
42
43