Search code examples
pythontkinterttkoptionmenu

ttk OptionMenu does not fit into its bounding box


I am facing a problem creating a Tkinter-application under Windows, using python 2.7. Basically, when I create an OptionMenu, its right corner (where a down button indicates that something happens when you click there) is truncated in the middle.

The following code reproduces the issue:

from Tkinter import Tk, StringVar
from ttk import OptionMenu

root = Tk()

options = list('ABC')
var = StringVar(value='A')
om = OptionMenu(root, var, var.get(), *options)
om.config(width=25)
om.pack()

root.mainloop()

The result looks on my computer like this:

Example of a truncated option menu

I have played around with the padx and ipadx keywords of the packing layout manager and also tried a grid layout instead. None of them lets me see the down-arrow completely.

I appreciate your helpful comments on this issue.


Solution

  • The same happens to me on Windows 7 but not on XP, both using Python 2.7. I have found a bug report which states is should be fixed in Tk 8.5.8. Updating Tcl/Tk in Python seems to be very complicated though