#3034 Width of menubutton too short on aqua with textvariable

obsolete: 8.5.11
open
Kevin Walzer
5
2012-11-16
2012-11-14
Russell Owen
No

The attached code shows a bug in menubutton on MacOS (aqua): if I specify the font and use textvariable then the menubutton is displayed in a width that is far too narrow.

I tried to work around it using update idletasks and had no luck.

One workaround that does work is to change the font size in the option database and then change it back again. This causes an ugly display glitch but it's better than nothing.

Discussion

  • Russell Owen
    Russell Owen
    2012-11-16

    The workaround I ended up with is as follows: if the user specifies a width of 0 then I add a callback that sets width whenever the menubutton text is changed This is slightly dangerous in that the user cannot manually change the width after constructing the menubutton, but works for my code. I was fortunate to be using a wrapper class, so I was able to add the patch in one place.

    This appears to be a genuine bug, not just a platform-specific quirk, because:
    - With a width of 0 surely the only sensible behavior is to display a menubutton that is wide enough to show all characters?
    - Changing the font size and then changing it back causes the problem to go away (the menubutton suddenly is wide enough to see all the text). If it was a platform-specific quirk then the display would remain the same.

     
  • Russell Owen
    Russell Owen
    2012-11-16

    • assigned_to: hobbs --> wordtech