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

Re^3: tk positioning of widgets

by Anonymous Monk
on Oct 24, 2012 at 09:22 UTC ( #1000582=note: print w/ replies, xml ) Need Help??


in reply to Re^2: tk positioning of widgets
in thread tk positioning of widgets

OK, I guess a picture is worth apx 1,000 words

:D So first, words which don't paint a picture, and now, a picture of what you're able to accomplish by yourself?

before (multi line)  perl -MTk  -MTk::WidgetDump  -e " $mw = tkinit; for(0..3){ $f = $mw->Frame(-bg => (qw/ red green blue orange /)[$_] )->pack(qw/-expand 1 -fill both /); $l = $f->Label(-text => qq/T$_/ ); $t = $f->Entry(-text => qq/E$_/); $_->pack(qw/-anchor nw /) for $l, $t; } $mw->WidgetDump; MainLoop "

after (same line)  perl -MTk  -MTk::WidgetDump  -e " $mw = tkinit; for(0..3){ $f = $mw->Frame(-bg => (qw/ red green blue orange /)[$_] )->pack(qw/-expand 1 -fill both /); $l = $f->Label(-text => qq/T$_/ ); $t = $f->Entry(-text => qq/E$_/); $_->pack(qw/-anchor nw -side left /) for $l, $t; } $mw->WidgetDump; MainLoop "

after (same line, one stretchy )  perl -MTk  -MTk::WidgetDump  -e " $mw = tkinit; for(0..3){ $f = $mw->Frame(-bg => (qw/ red green blue orange /)[$_] )->pack(qw/-expand 1 -fill both /); $l = $f->Label(-text => qq/T$_/ ); $t = $f->Entry(-text => qq/E$_/); $l->pack(qw/-anchor nw -side left /); $t->pack(qw/-anchor nw -side left -fill x -expand 1 /); } $mw->WidgetDump; MainLoop "

grid alternative (grid is tricky ) perl -MTk  -MTk::WidgetDump  -e " $mw = tkinit; $f = $mw->Frame(qw/-bg red/)->pack(qw/-expand 1 -fill both /); for(0..3){ $l = $f->Label(-text => qq/T$_/ ); $t = $f->Entry(-text => qq/E$_/); $l->grid(-row => $_, qw/ -column 1 /); $t->grid(-row => $_, qw/ -column 2 -sticky news /);  } $f->Label()->grid(qw/ -row 4 -column 2 -sticky news /);  $f->gridColumnconfigure ( 2, -weight=>1); $f->gridRowconfigure ( 4, -weight=>1); $mw->WidgetDump; MainLoop "


Comment on Re^3: tk positioning of widgets
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (5)
As of 2014-12-28 19:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (182 votes), past polls