]>
git.saurik.com Git - wxWidgets.git/blob - wxPython/tests/menu_replace.py
2 from wxPython
.wx
import *
4 class MainWindowFrame(wxFrame
):
6 def __init__(self
, parentframe
, title
):
8 wxFrame
.__init
__(self
, parentframe
, -1,
9 title
, size
=wxSize(500, 200))
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
)
18 self
.helpmenu
= wxMenu()
19 self
.othermenu
= wxMenu()
21 self
.mb
.Append(self
.helpmenu
, '&Help')
24 def switch(self
, event
):
26 lastmenu
= self
.mb
.GetMenuCount() - 1
27 self
.mb
.Replace(lastmenu
, self
.othermenu
, 'Other')
35 mainwin
= MainWindowFrame(NULL
, 'menutest')
37 self
.SetTopWindow(mainwin
)