On 4/23/10 1:23 PM, Joe Barfett wrote:
Hello again,
The last time I updated, I think my code was scrambled. I am still
having the same problem in that I cannot make a menu appear using
Tkinter on macpython. The exact same code works very well on my PC.


I'm using windows XP and python version 2.5 with Tkinter. A menu
appears. The exact same code on OSX 10.5 and 10.5 in macpython will
display a frame but no menu.
Can anyone help?
Thanks very much!
joe


Try this:

from Tkinter import *
root = Tk()
def hello():
    print "hello!"
# create a toplevel menu
menubar = Menu(root)
root.config(menu=menubar)
hellomenu=Menu(menubar)
menubar.add_cascade(label="Hello", menu=hellomenu)
hellomenu.add_command(label="Hello!", command=hello)
# display the menu
root.config(menu=menubar)
mainloop()

It adds a "hello" submenu that's visible on the Mac. I'm not sure why the other code works on Windows, but this should work too.

--Kevin

--
Kevin Walzer
Code by Kevin
http://www.codebykevin.com
_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss@python.org
http://mail.python.org/mailman/listinfo/tkinter-discuss

Reply via email to