Changing default icon in tkinter OptionMenu?
You can use the ttk.Combobox
widget instead:
om = Combobox(root, values=*myOptList)om.set(myVar)om.grid(sticky=W + E, padx=5, pady=5)om.config(compound='right', width=140)
You can turn off the indicator, and not use the compound
attribute. Create the arrow as a label with an image and no borders or text. You can then use place
to place the label on the far right of the button (using the relx
attribute). This is the type of thing place
is really good at.
You can disable the Indicator, and then use your own indicator image. Further adjust the position as it suits. Check the sample snippet below:
from Tkinter import*import PILfrom PIL import ImageTk, Imageclass MyOptionMenu(OptionMenu): def __init__(self, master, status, *options): self.var = StringVar(master) self.img = ImageTk.PhotoImage(Image.open("...")) #replace with your own indicator image self.var.set(status) OptionMenu.__init__(self, master, self.var, *options) self.config(indicatoron=0, image = self.img, font=('calibri',(10)),bg='white',width=12) self['menu'].config(font=('calibri',(10)),bg='white')root = Tk()mymenu = MyOptionMenu(root, 'Select status', 'a','b','c')mymenu.pack()root.mainloop()