[Python-bugs-list] [ python-Bugs-697546 ] Tkinter Help menu error with pythonw

SourceForge.net noreply@sourceforge.net
Wed, 05 Mar 2003 08:25:22 -0800


Bugs item #697546, was opened at 2003-03-04 22:51
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=697546&group_id=5470

Category: Macintosh
Group: Python 2.3
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: John Speno (corvus)
Assigned to: Jack Jansen (jackjansen)
Summary: Tkinter Help menu error with pythonw

Initial Comment:
Note: Test script attached which demonstrates this problem.

If I launch my application using pythonw, then the first item in its 'Help' menu is an extraneous 'x'       
which I didn't put there, and can't seem to get rid of. Actually, when I        
first switch to the application, each item in my Help menu is an 'x'. If I      
switch to another app then back, my menu items have their names back, and       
there's still the first mysterious 'x'.

If I wrap my application up into an applicaiton bundle (foo.app), and run it that way, the menus work as they should.

----------------------------------------------------------------------

>Comment By: Jack Jansen (jackjansen)
Date: 2003-03-05 17:25

Message:
Logged In: YES 
user_id=45365

After various false starts I found that the automatic enabling of Help menu creation can be disabled by specifying a length 1 array of help books in stead of a single help book. This seems to fix the problem.

Checked in as Mac/OSXResources/app/Info.plist rev. 1.9.

----------------------------------------------------------------------

Comment By: Jack Jansen (jackjansen)
Date: 2003-03-05 14:04

Message:
Logged In: YES 
user_id=45365

I can repeat this, and I think I know where the problem lies. Unfortunately I don't know how to fix it, yet.

Apparently something goes wrong because Python.app (which is used by pythonw) has plist file entries CFBundleHelp*, which cause it to get a help menu. This causes a help menu to be created automatically, which seems to interfere with Tk's own manual creation of a help menu.

A workaround is easy: remove those entries from the Python.app plist file and everything is fine.

The problem is that I need somewhere to put the Python documentation, and it has to be a .app bundle (that's the only thing AHRegisterHelpBook will accept).

That is: I may be able to use a .help bundle, I've come across them. I will investigate, and if this works I'll fix Python.app.

----------------------------------------------------------------------

Comment By: John Speno (corvus)
Date: 2003-03-04 23:03

Message:
Logged In: YES 
user_id=2138

It doesn't looke like my attachment worked. Here's the script:

#!/usr/local/bin/pythonw
import Tkinter

def hello():
    print "hello"

root = Tkinter.Tk()
root.title('menubar test')
menubar = Tkinter.Menu(root)
helpmenu = Tkinter.Menu(menubar, name='help', tearoff=0)
menubar.add_cascade(label="Help", menu=helpmenu, underline=0)
addhelp = helpmenu.add_command
addhelp(label='Window Help', underline=0, command=hello, state='normal')
addhelp(label='Menu Help', underline=9, command=hello, state='normal')
helpmenu.add_separator()
addhelp(label='About Assignments', underline=0, command=hello)
root.configure(menu=menubar)
root.mainloop()

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=697546&group_id=5470