[Tkinter-discuss] a couple of mac menu problems

Mark Summerfield list at qtrac.plus.com
Fri Jun 15 13:07:38 CEST 2012


Hi,

I'm trying to develop a cross-platform Tkinter app.

Here's a bit of code used to create the Help menu:

    if MAC:
	self.master.createcommand("tkAboutDialog", self.about_action)
	self.master.createcommand("::tk::mac::ShowHelp",
		self.help_action)
    helpMenu = tk.Menu(self.menubar, name="help")
    helpMenu.add_command(label="Help", underline=0,
	    command=self.help_action)
    if not MAC:
	helpMenu.add_command(label="About", underline=0,
		command=self.about_action)
    self.menubar.add_cascade(label="Help", underline=0,
	    menu=helpMenu)

I end up with these menus:

    ActivePython3.2 
	About ActivePython3.2 # correctly invokes my about action
	...

    Help
	Search # some apple-specific thing that just appears
	ActivePython3.2 Help # invokes my help action
	Help                 # invokes my help action

Problems:

(1) I don't know how to rename the "ActivePython3.2" menu to "My App".
(2) I don't know how to rename the "About ActivePython3.2" menu option
    to "About" or "About My App".
(3) I don't know how to eliminate the "ActivePython3.2 Help" menu option.
    If I don't do helpMenu.add_command() on the Mac that menu has no
    items ('cos the About is in the ActivePython3.2 menu) and so the
    Help menu doesn't appear at all.

Can anyone advise?

Thanks!

-- 
Mark Summerfield, Qtrac Ltd, www.qtrac.eu
    C++, Python, Qt, PyQt - training and consultancy
        "Advanced Qt Programming" - ISBN 0321635906
            http://www.qtrac.eu/aqpbook.html


More information about the Tkinter-discuss mailing list