473,471 Members | 1,707 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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 1943
"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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.