Re: [Tutor] Menus / Mac

2006-10-09 Thread John Fouhy
On 09 Oct 2006 15:43:01 -0400, Joel Levine <[EMAIL PROTECTED]> wrote:
> 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.

It works for me :-) (MBPro, Tiger)

Remember that macs have a universal menu bar.  If you click on the
window it created, the menubar at the top should change appropriately.

-- 
John.
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Menus / Mac

2006-10-09 Thread Joel Levine
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