标签:语言 def ade bar imp int item ui编程 eve
import tkinter
win = tkinter.Tk()
win.title("sunck")
win.geometry("400x400+200+20")
#菜单条
menubar = tkinter.Menu(win)
#菜单
menu = tkinter.Menu(menubar, tearoff=False)
for item in ["Python", "C", "C++", "OC", "Swift", "C#", "shell", "Java", "JS", "PHP", "汇编", "NodeJS", "退出"]:
menu.add_command(label=item)
menubar.add_cascade(label="语言", menu=menu)
def showMenu(event):
menubar.post(event.x_root, event.y_root)
win.bind("<Button-3>", showMenu)
win.mainloop()
Python GUI编程(Tkinter)17、Menu鼠标右键菜单
标签:语言 def ade bar imp int item ui编程 eve
原文地址:https://www.cnblogs.com/pygo/p/12917596.html