Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The 'filemenu' does not display when i run the right code, on macOS. #476

Closed
Raymon9 opened this issue Aug 21, 2017 · 3 comments
Closed

Comments

@Raymon9
Copy link

Raymon9 commented Aug 21, 2017

Operating system:macOS Sierra 10.12.6
wxPython version:4.0.0b1
Stock or custom build:custom
Python version:Python 3.6.2
Stock or custom build:custom

Description of the problem:
The 'filemenu' does not display when i run the code, which i copied from the wiki of wxpython. My laptop's system is macOS. The problem is not exist when I asked others for help, who use the Windows system. Is this a bug or any other problem? Thank you.
(http://wx4.sinaimg.cn/mw690/4bcb5221ly1firpu66lnsj20sg0wgwha.jpg)

#!/usr/bin/env python3
#-*- coding:utf-8 -*-

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()
        filemenu = wx.Menu()

        filemenu.Append(wx.ID_ABOUT, '&About', 'Information about this program')
        filemenu.AppendSeparator()
        filemenu.Append(wx.ID_EXIT, '&Exit', 'Terminate the programe')

        menuBar = wx.MenuBar()
        menuBar.Append(filemenu, '&File')
        self.SetMenuBar(menuBar)
        self.Show(True)

app = wx.App(False)
frame = MainWindow(None, 'Sample editor')
app.MainLoop()
@RobinD42
Copy link
Member

On Mac the menu items for wx.ID_EXIT, wx.ID_ABOUT and a few others are automatically moved to their correct place (according to Apple UI guidelines) on the application's menu. Until you make an app bundle for your application that will be the "Python" menu next to the apple menu. (With an app bundle then it will be the name you give your application.)

@Raymon9
Copy link
Author

Raymon9 commented Aug 22, 2017

Oh, I feel quite ashamed,it looks like a stupid question. Thank you very much for your quick reply.

@jconti13
Copy link

jconti13 commented May 5, 2018

I was confused by the same thing, don't feel bad. It actually looks like appending a menu item with wx.ID_EXIT is simply ignored. Simply adding:

menubar` = wx.MenuBar()
self.SetMenuBar(menubar)

Seems to be enough to get the default items including a "Quit" item to appear under the "Python" menu.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants