[issue42977] Tkinter Optionmenu Too Narrow on Mac
E. Paine
report at bugs.python.org
Thu Jan 21 09:42:38 EST 2021
E. Paine <paineelisha at gmail.com> added the comment:
I suspect this is just a MacOS behaviour, if not then it is a Tk bug. If you really need to enforce the width, you could tell it to expand horizontally in the layout. An example of this would be as follows:
tk.Frame(root, height=1, width=300).pack()
tk.OptionMenu(root, tk.StringVar(), "test").pack(fill="x")
A bit more detail on the Tk side of things:
tkinter doesn't actually use `tk_optionMenu` and instead creates its own menubutton and menu. The issue with the menubutton width not changing also exists when working directly with Tk (`pack [menubutton .p -width 100]`). However, the same behaviour can be shown when using `tk_optionMenu`, so changing tkinter to use that instead would not fix this issue.
----------
nosy: +epaine, serhiy.storchaka
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue42977>
_______________________________________
More information about the Python-bugs-list
mailing list