Drop down menu using button with image in tkinter
Does this solve Your issue?
from tkinter import *root = Tk()mbtn = Menubutton(root, text="Options", relief=RAISED)mbtn.pack()mbtn.menu = Menu(mbtn, tearoff = 0)mbtn["menu"] = mbtn.menumbtn.menu.add_checkbutton(label="Outing")mbtn.menu.add_checkbutton(label="Sleep")mbtn.menu.add_checkbutton(label="Tour")root.mainloop()
instead of mbtn.pack()
You can obviously also use mbtn.grid()
or mbtn.place()
(not suggested - .place()
)
@TheLizzard added: You can use root.config(menu=mbtn.menu)
(instead of mbtn.pack()
) to make the menu part of the window.