Python GUI编程(Tkinter)17、Menu鼠标右键菜单
import tkinterwin = 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()
相关推荐
HMHYY 2020-05-19
ITxiaobaibai 2020-02-19
lsjweiyi 2020-11-17
kikaylee 2020-05-31
singer 2020-05-07
Jonderwu 2020-05-07
xirongxudlut 2020-05-07
柠檬班 2020-02-03
chouliqingke 2019-12-24
liusarazhang 2019-10-29
canvaskin 2019-06-14
lanzh 2019-06-14
xavierri 2019-06-14
vevoly 2019-06-14
BmwGaara 2019-06-14
Wendywubowen 2019-06-14
pythonxuexi 2019-06-14
ciqingloveless 2019-06-13
oXiRiShi 2019-06-13