I'm attempting to add a menu bar to my Tkinter app. I can't figure out the correct syntax. Can someone help? I get this error when I run the app:<br><br>Traceback (most recent call last):<br> File "tkgrid.py", line 26, in <module><br>
app = App(root)<br> File "tkgrid.py", line 10, in __init__<br> menubar = Menu(master).grid(row=0)<br> File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-tk/Tkinter.py", line 1859, in grid_configure<br>
+ self._options(cnf, kw))<br>_tkinter.TclError: can't manage ".4300345712": it's a top-level window<br><br><br>from Tkinter import *<br><br>class App:<br><br> def __init__(self, master):<br> <br>
def hello():<br> print "hello!"<br><br> menubar = Menu(master).grid(row=0)<br> menubar.add_command(label="Hello!", command=hello)<br> Label(master, text="First").grid(row=1)<br>
Label(master, text="Second").grid(row=2)<br> <br> e1 = Entry(master)<br> e2 = Entry(master)<br> e3 = Entry(master)<br><br> e1.grid(row=0, column=1)<br> e2.grid(row=1, column=1)<br>
e2.grid(row=2, column=1)<br><br><br>root = Tk()<br><br>app = App(root)<br><br>root.mainloop()<br>