Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

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;

Comment on Re: Tk - aligning Labels
Download Code

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://993527]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (5)
As of 2016-02-13 06:58 GMT
Find Nodes?
    Voting Booth?

    How many photographs, souvenirs, artworks, trophies or other decorative objects are displayed in your home?

    Results (419 votes), past polls