in reply to Make Tk Optionmenu same height as Button

This works for me using the default fonts:

#! perl -slw use strict; use Tk; my $mw = MainWindow->new(); my $om = $mw->Optionmenu( -options => [ [fred => 1], [bill => 2] ] )->pack( -side=> 'left' ); my @btns = map { $mw->Button( -text => $_, -pady => 2 )->pack( -side=> 'left' ); } 1 .. 8; MainLoop;

With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

The start of some sanity?

Replies are listed 'Best First'.
Re^2: Make Tk Optionmenu same height as Button
by chessgui (Scribe) on Jan 25, 2012 at 03:15 UTC
    Sure it may be platform dependent.

    By the way what is this 'map' thing? Is this a relatively new function in perl or am I under educated?
      Sure it may be platform dependent.

      I cannot prove it without seeing your code, but I don't think so.

      The -pady values (without suffixes) are in pixels. The symptoms you describe (1 too small; 2 too big), are indicative that the y padding is being added both above and below. And that is indicative that the button is being packed with the default -anchor value which is centre.

      You should find that if you adjust the packing so that it is no longer centered, the -pady will only be added to one edge, allowing you to match it to the Optionmenu size with -pady =>1.

      By the way what is this 'map' thing?

      See map.


      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.

      The start of some sanity?

      By the way what is this 'map' thing? Is this a relatively new function in perl or am I under educated?

      Map has been there since 1994

        Then I'm under educated. I've just not have come across this function as of yet.