]> git.saurik.com Git - wxWidgets.git/blame - wxPython/tests/menu_replace.py
Reverted the warning fix since it breaks MinGW
[wxWidgets.git] / wxPython / tests / menu_replace.py
CommitLineData
c2229593
RD
1
2from wxPython.wx import *
3
4class 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
31class 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
40app = TheApp(0)
41app.MainLoop()
42
43