I'm trying to learn menus, starting with a textbook example.
The textbook example (pasted below) doesn't work, but doesn't die either: It
opens a window that has no menu.
I'm guessing it is a Mac problem. I've tried it on 3 different Macs, with
slightly different dates and configurations of Python and its libraries. Same
story each time.
But, mailing the same program to someone who pasted it into a PC program -- it
was fine.
On the Mac, I'm running straight from Terminal/Unix, that is, I'm not using
IDLE.
Hard to believe that something this basic would not be running & not be noticed
-- but I'm at a loss.
The program is below.
Thanks,
Joel Levine
from Tkinter import *
def callback():
print "called the callback!"
root = Tk()
# create a menu
menu = Menu(root)
root.config(menu=menu)
filemenu = Menu(menu)
menu.add_cascade(label="File", menu=filemenu)
filemenu.add_command(label="New", command=callback)
filemenu.add_command(label="Open...", command=callback)
filemenu.add_separator()
filemenu.add_command(label="Exit", command=callback)
helpmenu = Menu(menu)
menu.add_cascade(label="Help", menu=helpmenu)
helpmenu.add_command(label="About...", command=callback)
mainloop()
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor