By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,458 Members | 1,250 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,458 IT Pros & Developers. It's quick & easy.

what wrong with this program?

P: n/a
Ali
The following program is supposed to display a dropdown menu, however,
it only shows the File and Help things.

from Tkinter import *

root = Tk()

#create menu
m = Menu(root)
root.config(menu=m)

filemenu = Menu(m)
m.add_cascade(label="File", menu="filemenu")
filemenu.add_command(label="New", command=callback)
filemenu.add_separator()
filemenu.add_command(label="Quit", command=callback)

helpmenu = Menu(m)
m.add_cascade(label="Help", menu="helpmenu")
helpmenu.add_command(label="About...", command=callback)

root.mainloop()

please help fix this program.
Jul 18 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Ali wrote:
The following program is supposed to display a dropdown menu, however,
it only shows the File and Help things.

from Tkinter import *

root = Tk()

#create menu
m = Menu(root)
root.config(menu=m)

filemenu = Menu(m)
m.add_cascade(label="File", menu="filemenu")


The menu= argument needs to be the object itself, not a string.

See, e.g.

http://www.pythonware.com/library/tk...9-patterns.htm

--
Robert Kern
rk***@ucsd.edu

"In the fields of hell where the grass grows high
Are the graves of dreams allowed to die."
-- Richard Harter
Jul 18 '05 #2

P: n/a
Ali
Robert Kern <rk***@ucsd.edu> wrote in message news:<cf**********@news1.ucsd.edu>...
Ali wrote:
The following program is supposed to display a dropdown menu, however,
it only shows the File and Help things.

from Tkinter import *

root = Tk()

#create menu
m = Menu(root)
root.config(menu=m)

filemenu = Menu(m)
m.add_cascade(label="File", menu="filemenu")


The menu= argument needs to be the object itself, not a string.

See, e.g.

http://www.pythonware.com/library/tk...9-patterns.htm


ok I will try it out. Thanks for your help
Jul 18 '05 #3

P: n/a
Ali
Robert Kern <rk***@ucsd.edu> wrote in message news:<cf**********@news1.ucsd.edu>...
Ali wrote:
The following program is supposed to display a dropdown menu, however,
it only shows the File and Help things.

from Tkinter import *

root = Tk()

#create menu
m = Menu(root)
root.config(menu=m)

filemenu = Menu(m)
m.add_cascade(label="File", menu="filemenu")


The menu= argument needs to be the object itself, not a string.

See, e.g.

http://www.pythonware.com/library/tk...9-patterns.htm


ok I will try it out. Thanks for your help
Jul 18 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.