472,374 Members | 1,319 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,374 software developers and data experts.

Tkinter: populating Mac Help menu?

Hello all,

Creating a 'Help' menu 'by hand' on the Mac does not work, or rather, it
creates a *second* Help menu.

There are hints about how to do this at:

http://tkinter.unpythonic.net/wiki/Widgets/Menu

but so far those hints have not been enough :-) The following statements are
the result of several happy hours experimenting with dir(obj) for several
objects obj related to menus. (Jeeze, I love Python, but you knew that :-)

The url above suggests that the 'official' Mac menu is named x.help, where x
is the Tk name (a string) of the menubar. If menubar is the Tkinter menubar
widget, then I assume that x = menubar._w.

So given x (a string), how does one create a widget whose name is '%s.help'
% x ? This is a can of corn in Tk, but nothing comes to mind looking at the
Tkinter source code.

If my app does *not* create a help menu, then even long after the Mac
menubar is created, and the official (empty) Help menu is visible,
menubar.children does *not* contain an entry for the official Mac Help menu.
Thus, there appears to be no way to populate the official Help menu after
letting Tkinter create the Help menu. Naturally, I could be wrong :-)

Thanks for any help you can provide.
Edward
--------------------------------------------------------------------
Edward K. Ream email: ed*******@charter.net
Leo: http://webpages.charter.net/edreamleo/front.html
--------------------------------------------------------------------
Oct 10 '06 #1
4 1883
"Edward K. Ream" <ed*******@charter.netwrites:
Creating a 'Help' menu 'by hand' on the Mac does not work, or
rather, it creates a *second* Help menu.
Presuming you are talking about MacOS X, it doesn't for me.
See Gato from http://gato.sourceforge.net/Download/

The menu code is at <http://svn.sourceforge.net/viewvc/gato/
trunk/Gato/Gato.py?revision=275&view=markup>

Alexander

--
Alexander Schliep sc*****@molgen.mpg.de http://algorithmics.molgen.mpg.de
Oct 11 '06 #2
On Tue, 10 Oct 2006 14:29:46 +0200, Edward K. Ream <ed*******@charter.net
wrote:
[snip]
So given x (a string), how does one create a widget whose name is
'%s.help'
% x ? This is a can of corn in Tk, but nothing comes to mind looking at
the
Tkinter source code.
Use the 'name' keyword when creating the menu itself:

----------------------------------------------------
from Tkinter import *

root = Tk()

mb = Menu(root)
root.configure(menu=mb)

## Normal menu
fm = Menu(mb)
fm.add_command(label='Quit', command=root.quit)
mb.add_cascade(label='File', menu=fm)

## Help menu with a specific name
hm = Menu(mb, name='help')
hm.add_command(label='About...')
mb.add_cascade(label='Help', menu=hm)

root.mainloop()
----------------------------------------------------

I didn't test it on MacOS-X, but the same trick should be used when
creating help menus on Unix (this menu is supposed to appear at the right
of the menubar according to Motif conventions).

HTH
--
python -c "print ''.join([chr(154 - ord(c)) for c in
'U(17zX(%,5.zmz5(17l8(%,5.Z*(93-965$l7+-'])"
Oct 11 '06 #3
Thanks for these replies. I'll try these ideas soon and report back on my
experiences.

Edward
--------------------------------------------------------------------
Edward K. Ream email: ed*******@charter.net
Leo: http://webpages.charter.net/edreamleo/front.html
--------------------------------------------------------------------
Oct 11 '06 #4
hm = Menu(mb, name='help')

Yes, that worked. Many thanks for your help with Help.

Edward
--------------------------------------------------------------------
Edward K. Ream email: ed*******@charter.net
Leo: http://webpages.charter.net/edreamleo/front.html
--------------------------------------------------------------------
Oct 15 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Josh | last post by:
Caution, newbie approaching... I'm trying to come up with a very simple Tkinter test application that consists of a window with a drop-down menu bar at the top and a grid of colored rectangles...
1
by: midtoad | last post by:
I'm trying to display a GIF image in a label as the central area to a Tkinter GUI. The image does not appear, though a space is made for it. Why is this so? I notice that I can display a GIF...
0
by: Stewart Midwinter | last post by:
I have a Tkinter app running on cygwin. It includes a Test menu item that does nothing more than fetch a directory listing and display it in a Toplevel window (I'd use a tkMessageBox showinfo...
3
by: joshdw4 | last post by:
I hate to do this, but I've thoroughly exhausted google search. Yes, it's that pesky root window and I have tried withdraw to no avail. I'm assuming this is because of the methods I'm using. I...
2
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
2
by: Ricardo de Mila | last post by:
Dear people, good afternoon... I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control. Than I need to discover what...
1
by: ezappsrUS | last post by:
Hi, I wonder if someone knows where I am going wrong below. I have a continuous form and two labels where only one would be visible depending on the checkbox being checked or not. Below is the...
0
by: jack2019x | last post by:
hello, Is there code or static lib for hook swapchain present? I wanna hook dxgi swapchain present for dx11 and dx9.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.