http://www.perlmonks.org?node_id=993534


in reply to Tk - aligning Labels

Another option is to use the 'form' geometry manager:

#!/usr/bin/perl use strict; use warnings; use Tk; use Tk::widgets qw(LabFrame); my $mw = MainWindow->new; $mw->title('First App'); #--- Locations my $locations_f = $mw->LabFrame( -label => 'Locations', -labelside => 'acrosstop', -foreground => 'blue', ); $locations_f->pack( -side => 'top', -expand => 1, -fill => 'x', ); #-- locations my $llocations = $locations_f->Label( -text => 'Locations' ); $llocations->form( -top => [ %0, 0 ], -left => [ %0, 5 ], ); my $elocations = $locations_f->Entry( -width => 20, ); $elocations->form( -top => [ %0, 0 ], -left => [ %0, 80 ], -padright => 5, ); #-- types my $ltypes = $locations_f->Label( -text => 'Types' ); $ltypes->form( -top => [ $llocations, 8 ], -left => [ %0, 5 ], ); my $etypes = $locations_f->Entry( -width => 15, ); $etypes->form( -top => [ '&', $ltypes, 0 ], -left => [ %0, 80 ], -padbottom => 5, ); MainLoop;

Regards, Ştefan