in reply to Re: Perl/Tk: Issues with external padding
in thread Perl/Tk: Issues with external padding

Looking at this example, it doesn't matter which value -padx has, the padding between the buttons will always be twice as big. If i set padx to 5, the padding between the buttons will be 10.

Replies are listed 'Best First'.
Re^3: Perl/Tk: Issues with external padding
by afoken (Chancellor) on May 13, 2010 at 14:08 UTC

    Sounds completely reasonable. Each button has an invisible border ("padding") of 10 pixel, so the distance from button to button is 20 pixel. With a padding of 5 pixel per button, you get a distance of 10 pixel.

    Alexander

    --
    Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
      Yes, it sounds reasonable, but at the end it doesn't look good.
      I created a screenshot to better illustrate my situation.

      Screenshot

      The result should be that the distance of the red lines is the same like the green lines.

      Regards,
      unknown-monk
        Hi,

        you can embed the widgets enclosed by the green line in an extra frame and add padding to that frame like so:

        use warnings; use strict; use Tk; my $mw =MainWindow ->new; my $f = $mw->Frame()->pack(-ipadx => 5); $f -> Button(-width => 10)->grid(-row => 0, -column => 0, -padx => 5); $f -> Button(-width => 10)->grid(-row => 0, -column => 1, -padx => 5); MainLoop;

        Also, your screen layout looks like it could be easier defined using the Tk::pack geometry manager.

        Cheers, Chris
        update: Added example
        Would an empty frame of a given size help you?