Here is a small example for using the form geometry manager, maybe it will be useful for someone. I used -padleft to stick with the subject of the thread but -padx will do the same in this case.

#!/usr/bin/perl use strict; use warnings; use Tk; use Tk::widgets qw{ LabFrame }; my $main = MainWindow->new; #--- Frame 1 my $frame1 = $main->LabFrame( -foreground => 'blue', -label => 'Frame 1', -labelside => 'acrosstop', ); $frame1->grid( $frame1, -row => 0, -column => 0, -ipadx => 3, -ipady => 3, ); #-- column1 my $lcolumn1 = $frame1->Label( -text => 'Label 1', ); $lcolumn1->form( -left => [ %0, 0 ], -top => [ %0, 0 ], -padleft => 5, ); my $ecolumn1 = $frame1->Entry( -width => 15, ); $ecolumn1->form( -top => [ '&', $lcolumn1, 0 ], -left => [ %0, 60 ], ); #-- column2 my $lcolumn2 = $frame1->Label( -text => 'Label 2', ); $lcolumn2->form( -top => [ $lcolumn1, 8 ], -left => [ %0, 0 ], -padleft => 5, ); my $ecolumn2 = $frame1->Entry( -width => 35, ); $ecolumn2->form( -top => [ '&', $lcolumn2, 0 ], -left => [ %0, 60 ], ); #-- column3 my $lcolumn3 = $frame1->Label( -text => 'Label 3', ); $lcolumn3->form( -top => [ $lcolumn2, 8 ], -left => [ %0, 0 ], -padleft => 5, ); my $ecolumn3 = $frame1->Entry( -width => 10, ); $ecolumn3->form( -top => [ '&', $lcolumn3, 0 ], -left => [ %0, 60 ], ); #-+ column4 my $ecolumn4 = $frame1->Entry( -width => 10, ); $ecolumn4->form( -top => [ '&', $lcolumn3 ], -right => [ %100, -6 ], ); my $lcolumn4 = $frame1->Label( -text => 'Label 4', ); $lcolumn4->form( -top => [ '&', $lcolumn3, 0 ], -right => [ $ecolumn4, -10 ], -padleft => 5, ); MainLoop;

The advantage of form manager is that the positioning of the widgets is precise.

You are right, it has resizing problems, but I see no other drawbacks. The spring option(s) would be a nice feature but it doesn't work unfortunately, I wish I could implement them but:

"I'm not really a 'programmer', but I play one on earth."
Best regards to all Monks, Stefan :-)

In reply to Re^5: Perl/Tk padding only on one side by stefbv
in thread Perl/Tk padding only on one side by Dirk80

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.