[Pythonmac-SIG] Tkinter and the Help menu

John Speno macpython@lopan.dccs.upenn.edu
Tue, 4 Mar 2003 15:23:08 -0500


My original post is below. The gist of the problem was a funky 'Help' menu.

It turns out that this only happened when running my script with pythonw.
If I launched the script in its own application bundle, the 'Help' menu was
correct.

So, it looks like I can't count on pythonw to test my code. I don't get the
difference between the two methods on the back end. Can somone explain it
to me?

Now, on to the next set of exceptions! *sigh*

Thanks!

On Fri, Feb 28, 2003 at 01:24:39PM -0500, John Speno wrote:
> Platform: MacOS X 10.2.4, Python 2.3a2, Tcl and Tk 8.4.1 jaguar.
> 
> Issue: In my application's Help menu, the first item 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'.
> 
> Anyone encounter that before? I suppose I can try the TOT build of
> Tcl/Tk...
> 
> Thanks!
> 
> #!/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()