我用Tkinter创建了一个带有图像的菜单按钮。我在菜单按钮中添加了一个标签和两个纽扣。什么时候我运行我的应用程序,它工作正常,直到我点击两次菜单按钮。它开始滞后,然后崩溃。你知道吗
这是我的密码:
from Tkinter import *
from PIL import ImageTk
def donothing():
print("NOTHING")
root = Tk()
root.geometry("300x300")
Menu_Photo = Menubutton(root)
Photo = ImageTk.PhotoImage(file="image.png")
Menu_Photo.config(image=Photo)
Menu_Photo.image = Photo
Menu_Photo.menu = Menu(Menu_Photo, tearoff=0, relief=FLAT)
Menu_Photo["menu"] = Menu_Photo.menu
Menu_Photo.menu.label = Label(Menu_Photo.menu, text="Menu")
Menu_Photo.menu.Settings = Button(Menu_Photo.menu, text="Settings", relief=FLAT, command=donothing)
Menu_Photo.menu.Sign_Out = Button(Menu_Photo.menu, text="Sign Out", relief=FLAT, command=donothing)
Menu_Photo.menu.label.pack()
Menu_Photo.menu.Settings.pack(fill=BOTH)
Menu_Photo.menu.Sign_Out.pack(fill=BOTH)
Menu_Photo.pack(side=RIGHT, anchor=N)
root.mainloop()
我真的不明白有什么问题?你知道吗
对我来说就是这样:
目前没有回答
相关问题 更多 >
编程相关推荐