Reputation: 1779
Is it possible to configure a menubar with wx.wizard? It appears the class doesn't have a SetMenuBar method. The following fails with the error: AttributeError: 'MyWizard' object has no attribute 'SetMenuBar'
.
import wx
import wx.wizard
class MyWizard(wx.wizard.Wizard):
def __init__(self):
wx.wizard.Wizard.__init__(self, None, id=wx.ID_ANY, title="Test", pos=wx.DefaultPosition, style=wx.DEFAULT_DIALOG_STYLE)
self.m_pages = []
self.m_wizPage = wx.wizard.WizardPageSimple(self)
self.add_page(self.m_wizPage)
# Menu
menub = wx.MenuBar()
# File Menu
filem = wx.Menu()
filem.Append(wx.ID_OPEN, "Open\tCtrl+O")
menub.Append(filem, "&File")
self.SetMenuBar(menub)
def add_page(self, page):
if self.m_pages:
previous_page = self.m_pages[-1]
page.SetPrev(previous_page)
previous_page.SetNext(page)
self.m_pages.append(page)
if __name__ == '__main__':
app = wx.App(False)
wiz = MyWizard()
wiz.RunWizard(wiz.m_pages[0])
wiz.Destroy()
Upvotes: 0
Views: 88
Reputation: 6206
No. The Wizard
class derives from wx.Dialog
, and dialogs do not have menus. If you really want one then you can try using the generic implementation in wx.lib.agw.flatmenu
.
Upvotes: 1