For Tk problems, it's often useful to know the platform and the Tk version that you're using. I know, for example, that the height of Buttons in Windows was noticable different than in Unix -- or at least it used to be. It had to do with how the y padding was done. On my Windows machine I ran a simple test script, and the Buttons were shorter than I recall which means that maybe something was done to fix this problem in recent versions.

I used to work around this by rolling my own Button by subclassing Label and adding minimal Button-like bindings. This was one of the reasons why I chose to do this for JComboBox, as an example.

GeometryRequest can be fiddly and I have a hard time recommending it, When you use it, you start to contradict what the geometry manager wants to do, and often you end up with a tug-of-war over control of the layout where a widget changes size in odd ways. I would also suggest that by setting a hard-coded value for the height of the Button, then you are potentially putting yourself at odds with whatever the user has designated as the desired height. If you force it to be shorter than the font, then some portion of the text will be clipped.

As Zentara pointed out, the height of a Button or Label is determined primary by the font, but other factors contribute such as:

Of these, typically the one that's causing the problem is the -pady setting. (In the other post, I provided one way of setting this for all the Headers).

Another approach that can be used to constrain the height of a Button would be pack it inside a Frame, then disable pack propagation on that Frame. Now you can control the size of the Button through it's container, and specify a pixel value. As I mentioned before, this is generally *not* a good thing because you want the Button to be at least as tall as the font.


In reply to Re: Changing Buttonsize in MListbox by rcseege
in thread Changing Buttonsize in MListbox by Ace128

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.