免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 3297 | 回复: 1
打印 上一主题 下一主题

python调用wx创建窗口,菜单栏不显示,为何? [复制链接]

论坛徽章:
2
2015年迎新春徽章
日期:2015-03-04 10:16:532015元宵节徽章
日期:2015-03-06 15:53:22
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2017-01-03 09:37 |只看该作者 |倒序浏览
如题,有一个简单的例子程序:

  1. import wx

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

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

  9.         # wx.ID_ABOUT and wx.ID_EXIT are standard IDs provided by wxWidgets.
  10.         filemenu.Append(wx.ID_ABOUT, "&About"," Information about this program")
  11.         filemenu.AppendSeparator()
  12.         filemenu.Append(wx.ID_EXIT,"E&xit"," Terminate the program")

  13.         # Creating the menubar.
  14.         menuBar = wx.MenuBar()
  15.         menuBar.Append(filemenu,"&File") # Adding the "filemenu" to the MenuBar
  16.         self.SetMenuBar(menuBar)  # Adding the MenuBar to the Frame content.
  17.         self.Show(True)

  18. app = wx.App(False)
  19. frame = MainWindow(None, "Sample editor")
  20. app.MainLoop()
复制代码

执行的结果如下图:

为什么不能显示呢?


论坛徽章:
0
2 [报告]
发表于 2017-12-23 22:30 |只看该作者
你使用的是Mac OS吗?如果是的话,菜单在顶部。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP