Macos 正在运行wxpython的示例代码,但菜单项未显示
我可以看到&File菜单,但它是空的。它不包含关于和退出项。我错过了什么 以下是原始的wiki页面及其代码: 非常感谢Macos 正在运行wxpython的示例代码,但菜单项未显示,macos,wxpython,Macos,Wxpython,我可以看到&File菜单,但它是空的。它不包含关于和退出项。我错过了什么 以下是原始的wiki页面及其代码: 非常感谢 另外:如果我用一些随机数替换ID_ABOUT和ID_EXIT,它就会工作。无论如何,我不想这样做,因为这不是标准的方法。回答了我的问题。它在那里创建了菜单项,但我没有注意到,因为我没有仔细检查。感谢所有对这个问题感兴趣的人在python2.7(Debian Jessie Linux)上与我配合得很好…..使用了ID_ABOUT和ID_EXIT…..嗯..我认为这个问题与MacO
另外:如果我用一些随机数替换ID_ABOUT和ID_EXIT,它就会工作。无论如何,我不想这样做,因为这不是标准的方法。回答了我的问题。它在那里创建了菜单项,但我没有注意到,因为我没有仔细检查。感谢所有对这个问题感兴趣的人在python2.7(Debian Jessie Linux)上与我配合得很好…..使用了ID_ABOUT和ID_EXIT…..嗯..我认为这个问题与MacOSX密切相关。。Python2.7.10此处也检查此链接。似乎股票ID仅适用于OSX上的应用程序菜单小部件。。。。确实是一个bug,但操作系统平台问题
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.
filemenu.Append(wx.ID_ABOUT, "&About"," Information about this program")
filemenu.AppendSeparator()
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.
self.Show(True)
app = wx.App(False)
frame = MainWindow(None, "Sample editor")
app.MainLoop()