unknown-monk has asked for the wisdom of the Perl Monks concerning the following question:

Dear Monks,
I'm having issues with defining external paddings like I want.
#!/usr/local/bin/perl -w use Tk; my $mw =MainWindow ->new; $mw -> Button()->grid(-row => 0, -column => 0, -padx => 10); $mw -> Button()->grid(-row => 0, -column => 1, -padx => 10); MainLoop;
My main problem is that the total padding between this two buttons is 20, but I want it to also be 10, of course without setting the external padding of both buttons to 5.
I guess one cannot set padx only for left or right side of the widget?
Btw. I'm experiencing the same "issue" with pady, but let's start with padx.
Hope I was clear enough?

Kind regards,
unknown-monk

Replies are listed 'Best First'.
Re: Perl/Tk: Issues with external padding
by lamprecht (Friar) on May 13, 2010 at 12:57 UTC
    Hi,

    It might be easier to help you if you share your reason against setting -padx => 5.

    Cheers, Chris
      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.

        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". ;-)