from Tkinter import *
def donothing():
filewin = Toplevel(root)
button = Button(filewin, text="Do nothing button")
button.pack()
root = Tk()
menu = Menu(root, tearoff=0)
menu.add_command(label="Cut", command=donothing)
menu.add_command(label="Copy", command=donothing)
menu.add_command(label="Paste", command=donothing)
menu.add_command(label="Delete", command=donothing)
frame = Frame(root, width=100, height=100)
frame.pack()
def popupmenu(event):
menu.post(event.x_root, event.y_root)
frame.bind("<Button-3>", popupmenu)
root.mainloop()
|