Search code examples
pythonbuttontkinteroptionmenu

Avoiding Tkinter OptionMenu button resizing


I've the following OptionMenu:

self.textoprioridad = Label(self.frameTwo, text = "Prioridad: ", justify="center")
self.textoprioridad.grid(row=n, column=4)
var2 = StringVar()
menu2 = OptionMenu(self.frameTwo, var2, "Primera pieza", "Esta semana", "Normal", "Baja")
menu2.grid(row=n, column=5, ipadx=10)
var2.set("Primera pieza")
self.optionmenus_prioridad.append((menu2, var2))

That shows something like this:

enter image description here

The thing is that if I choose Normal from the list, the button resized and it makes smaller: enter image description here

I would like to know if it's any way to keep the OptionMenu button with the initial size, like this: enter image description here

Thanks in advance.


Solution

  • Specify width by config(width=desired-width):

    menu2.config(width=20)