Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Re: Tk - aligning Labels

by thundergnat (Deacon)
on Sep 13, 2012 at 16:05 UTC ( #993527=note: print w/replies, xml ) Need Help??

in reply to Tk - aligning Labels

Maybe use a different geometry manager? grid perhaps? Just remember to not mix geometry managers in a single container widget. e.g. Below, the stuff in $mw is 'pack'ed but the stuff in $frmTop is 'grid'ed.

UPDATE: added -sticky attributes.

#!/usr/bin/perl use strict; use Tk; my $btypes; my $locations; my $bstats; my $mw; $mw = MainWindow->new; $mw->geometry("400x300"); $mw->title("First App"); my $frmTop = $mw->Frame(-bd => 2,-relief => 'ridge')->pack(-side => 't +op', -fill => 'x', -pady => 3); # Location label/entry my $lblLocationsID = $frmTop->Label(-text => "Locations") ->grid(-row => 0, -column => 0, -sticky => 'w'); my $edtLocationsID = $frmTop->Entry(-textvariable => \$locations,-back +ground => 'white') ->grid(-row => 0, -column => 1); # type label/entry my $lblBtypeID = $frmTop->Label(-text => "Types") ->grid(-row => 1, -column => 0, -sticky => 'w'); my $edtBtypeID = $frmTop->Entry(-textvariable => \$btypes, -background + => 'white') ->grid(-row => 1, -column => 1); MainLoop;

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://993527]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (8)
As of 2017-03-23 22:27 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (294 votes). Check out past polls.