Python GUI编程(Tkinter)17、Menu鼠标右键菜单
2021-01-17 19:12
标签:语言 def ade bar imp int item ui编程 eve Python GUI编程(Tkinter)17、Menu鼠标右键菜单 标签:语言 def ade bar imp int item ui编程 eve 原文地址:https://www.cnblogs.com/pygo/p/12917596.htmlimport 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("
win.mainloop()
上一篇:Python内置函数示例
下一篇:java集合-HashMap
文章标题:Python GUI编程(Tkinter)17、Menu鼠标右键菜单
文章链接:http://soscw.com/index.php/essay/43316.html