Problems with Tkinter and menus
Bill Melcher
wpmelcher at snet.net
Thu Dec 13 11:13:11 EST 2001
I am running Python 2.1.1 under Win98 and tried:
import Tkinter
def hello():
print "hello!"
root = Tkinter.Tk()
menu0 = Tkinter.Menu(root, tearoff=0)
menu1 = Tkinter.Menu(root, tearoff=0)
menu1.add_command(label="Foo", command=hello)
menu1.add_command(label="Bar", command=hello)
menu0.add_command(label="Command 1", command=hello)
menu0.add_cascade(label="Menu 1", menu=menu1)
frame = Tkinter.Frame(root, width=200, height=200)
frame.pack()
def showMenu(event):
menu0.post(event.x_root, event.y_root)
frame.bind("<Button-3>", showMenu)
Tkinter.mainloop()
No hello, no menus and no errors reported. The origional version posted by
Fredrik Juhlin showed the same behavior.
Any ideas?
--
Cheers, Bill
TANSTAAFL!
More information about the Python-list
mailing list