Old Code? No Menu bars. when run under Phoenix

Okay, a slight tangent… I’m going through some old wxPython tutorials, trying to educate myself on it…

So far, pretty standard…


import os
import wx

class MainWindow(wx.Frame):
    def __init__(self, parent, title):
        wx.Frame.__init__(self, parent, title=title, size=(200,100))
        self.control = wx.TextCtrl(self, style=wx.TE_MULTILINE)
        self.CreateStatusBar() # A StatusBar in the bottom of the window

        # Setting up the menu.
        filemenu= wx.Menu()

        # wx.ID_ABOUT and wx.ID_EXIT are standard ids provided by wxWidgets.
        menuAbout = filemenu.Append(wx.ID_ABOUT, "&About"," Information about this program")
        menuExit = filemenu.Append(wx.ID_EXIT,"E&xit"," Terminate the program")

        # Creating the menubar.
        menuBar = wx.MenuBar()
        menuBar.Append(filemenu,"&File") # Adding the "filemenu" to the MenuBar
        self.SetMenuBar(menuBar)  # Adding the MenuBar to the Frame content.

        # Set events.
        self.Bind(wx.EVT_MENU, self.OnAbout, menuAbout)
        self.Bind(wx.EVT_MENU, self.OnExit, menuExit)


    def OnAbout(self,e):
        # A message dialog box with an OK button. wx.OK is a standard ID in wxWidgets.
        dlg = wx.MessageDialog( self, "A small text editor", "About Sample Editor", wx.OK)
        dlg.ShowModal() # Show it
        dlg.Destroy() # finally destroy it when finished.

    def OnExit(self,e):
        self.Close(True)  # Close the frame.

app = wx.App(False)
frame = MainWindow(None, "Sample editor")

It runs fine, creates the input field, but no menu bars. There are no exceptions, runtime errors, so I’m a bit confused on why there’s no menu…

Can anyone point me in the right direction?

It’s running fine here on Windows, Python 3.6, wxPython 4.1.0 or 3.6 plus 4.0.7.


If you’re on Mac OSX then the menubar is at the top of the screen where every other application has its menubar when they are active.

100% correct.

I don’t know why that didn’t click. Actually I do know why, I’m use to GUI toolkits faking menu bars, and not using the native Mac Menu bar.

Thank you. Realizing that, it works fine one I used the menu bar options. I had a bit of Py2 -> Py3 converting to do. But it’s done, and it’s working fine (so far) under Py3 & WxPython v4.

Thanks for the help.