Try not adding the menubar to the frame until after you've built the help menu. IIRC, that is the point in time that it merges the wx menu with the system menu.
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
Try not adding the menubar to the frame until after you've built the help menu. IIRC, that is the point in time that it merges the wx menu with the system menu.
Chis pointed out the Wiki article on menus and osx...I ran the example and
it works fine.
I suspect that my situation is a bit more problematic because my app
starts by popping up a dialog box to gather information that is needed
to initialize the "main frame". (data base connection parameters and a connection descriptor)
Here is the tail end of my frame init code:
HelpMenu = wx.Menu()
pgHelpItem = HelpMenu.Append(wx.ID_HELP,"Postgresql Help")
item = HelpMenu.Append(wx.ID_ABOUT, "&About",
"More information About this program")
menuBar.Append(HelpMenu,"Help")
self.Bind(wx.EVT_MENU, self.OnLoadHelp,pgHelpItem)
The "About" item *does* appear in the Python menu, but the Help menu
is not merged with the System help menu and I have two help menus appearing
in the menu bar.
Thanks,
Jerry
···
On May 30, 2007, at 12:36 AM, Robin Dunn wrote:
Jerry LeVan wrote:
Hi,
On my mac Python 2.5.1/wxPython 2.8.4 It appears that one
gets "for free" a "Windows" and "Help" menu in the menubar
when running a wxPython program.
I cannot figure out how to append a menu item to this Help menu.
(and I generally have to click the menubar before it even appears).
If I try code like:
HelpMenu = wx.Menu()
menuBar.Append(HelpMenu,"Help")
self.pgHelpItem = HelpMenu.Append(-1,"Postgresql Documentation")
self.Bind(wx.EVT_MENU, self.OnLoadHelp,self.pgHelpItem)
I get an additional help menu with my menu item.
Try not adding the menubar to the frame until after you've built the help menu. IIRC, that is the point in time that it merges the wx menu with the system menu.
> Jerry LeVan wrote:
>> Hi,
>> On my mac Python 2.5.1/wxPython 2.8.4 It appears that one
gets "for
>> free" a "Windows" and "Help" menu in the menubar when running a
>> wxPython program. I cannot figure out how to append a menu item to
>> this Help menu. (and I generally have to click the menubar
before it
>> even appears). If I try code like:
>> HelpMenu = wx.Menu()
>> menuBar.Append(HelpMenu,"Help")
>> self.pgHelpItem = HelpMenu.Append(-1,"Postgresql
>> Documentation")
>> self.Bind(wx.EVT_MENU, self.OnLoadHelp,self.pgHelpItem)
>> I get an additional help menu with my menu item.
>
> Try not adding the menubar to the frame until after you've built
> the help menu. IIRC, that is the point in time that it merges the
> wx menu with the system menu.
>
Chis pointed out the Wiki article on menus and osx...I ran the
example and
it works fine.
I suspect that my situation is a bit more problematic because
my app starts by popping up a dialog box to gather
information that is needed to initialize the "main frame".
(data base connection parameters and
a connection descriptor)
Here is the tail end of my frame init code:
HelpMenu = wx.Menu()
pgHelpItem = HelpMenu.Append(wx.ID_HELP,"Postgresql Help")
item = HelpMenu.Append(wx.ID_ABOUT, "&About",
"More information About this
program")
menuBar.Append(HelpMenu,"Help")
self.Bind(wx.EVT_MENU, self.OnLoadHelp,pgHelpItem)
The "About" item *does* appear in the Python menu, but the
Help menu is not merged with the System help menu and I have
two help menus
appearing
in the menu bar.
Is the requirement of the '&' documented anywhere?
Thanks....
Jerry
···
On May 30, 2007, at 11:02 AM, David Woods wrote:
On May 30, 2007, at 12:36 AM, Robin Dunn wrote:
Jerry LeVan wrote:
Hi,
On my mac Python 2.5.1/wxPython 2.8.4 It appears that one
gets "for
free" a "Windows" and "Help" menu in the menubar when running a
wxPython program. I cannot figure out how to append a menu item to
this Help menu. (and I generally have to click the menubar
before it
even appears). If I try code like:
HelpMenu = wx.Menu()
menuBar.Append(HelpMenu,"Help")
self.pgHelpItem = HelpMenu.Append(-1,"Postgresql
Documentation")
self.Bind(wx.EVT_MENU, self.OnLoadHelp,self.pgHelpItem)
I get an additional help menu with my menu item.
Try not adding the menubar to the frame until after you've built
the help menu. IIRC, that is the point in time that it merges the
wx menu with the system menu.
Chis pointed out the Wiki article on menus and osx...I ran the
example and
it works fine.
I suspect that my situation is a bit more problematic because
my app starts by popping up a dialog box to gather
information that is needed to initialize the "main frame".
(data base connection parameters and
a connection descriptor)
Here is the tail end of my frame init code:
HelpMenu = wx.Menu()
pgHelpItem = HelpMenu.Append(wx.ID_HELP,"Postgresql Help")
item = HelpMenu.Append(wx.ID_ABOUT, "&About",
"More information About this
program")
menuBar.Append(HelpMenu,"Help")
self.Bind(wx.EVT_MENU, self.OnLoadHelp,pgHelpItem)
The "About" item *does* appear in the Python menu, but the
Help menu is not merged with the System help menu and I have
two help menus
appearing
in the menu bar.
Actually, I saw it mentioned on the wiki page referenced earlier in this
thread, or I probably wouldn't have noticed it either. But I went through
the same process a few years ago, so I'm sympathetic.
David
···
On May 30, 2007, at 11:02 AM, David Woods wrote:
>> On May 30, 2007, at 12:36 AM, Robin Dunn wrote:
>>
>>> Jerry LeVan wrote:
>>>> Hi,
>>>> On my mac Python 2.5.1/wxPython 2.8.4 It appears that one
>> gets "for
>>>> free" a "Windows" and "Help" menu in the menubar when running a
>>>> wxPython program. I cannot figure out how to append a
menu item to
>>>> this Help menu. (and I generally have to click the menubar
>> before it
>>>> even appears). If I try code like:
>>>> HelpMenu = wx.Menu()
>>>> menuBar.Append(HelpMenu,"Help")
>>>> self.pgHelpItem = HelpMenu.Append(-1,"Postgresql
>>>> Documentation")
>>>> self.Bind(wx.EVT_MENU,
self.OnLoadHelp,self.pgHelpItem) I
>>>> get an additional help menu with my menu item.
>>>
>>> Try not adding the menubar to the frame until after
you've built the
>>> help menu. IIRC, that is the point in time that it merges the wx
>>> menu with the system menu.
>>>
>>
>> Chis pointed out the Wiki article on menus and osx...I ran the
>> example and it works fine.
>>
>> I suspect that my situation is a bit more problematic
because my app
>> starts by popping up a dialog box to gather information that is
>> needed to initialize the "main frame". (data base connection
>> parameters and a connection descriptor)
>>
>> Here is the tail end of my frame init code:
>>
>> HelpMenu = wx.Menu()
>> pgHelpItem = HelpMenu.Append(wx.ID_HELP,"Postgresql Help")
>> item = HelpMenu.Append(wx.ID_ABOUT, "&About",
>> "More information About this
>> program")
>> menuBar.Append(HelpMenu,"Help")
>> self.Bind(wx.EVT_MENU, self.OnLoadHelp,pgHelpItem)
>>
>> self.SetMenuBar(menuBar)
>> #self.CreateStatusBar()
>> self.Bind(wx.EVT_CLOSE, self.OnClose)
>>
>> The "About" item *does* appear in the Python menu, but the
Help menu
>> is not merged with the System help menu and I have two help menus
>> appearing
>> in the menu bar.
>>
>> Thanks,
>>
>> Jerry
>
> Jerry,
>
> You're missing the ampersand:
>
> menuBar.Append(HelpMenu,"&Help")
>
> David
>
Holy Mackerel, you are correct! It works fine now
Is the requirement of the '&' documented anywhere?
Is the requirement of the '&' documented anywhere?
Yes. Macs don't support "mnemonic shortcuts"! lol.
Right, but the code that merges the app's menus into the standard system menus assumes that your app will be following the standards for the other platforms, so that is why it looks for "&Help".
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!