in reply to tk positioning of widgets
In your example code, you didn't say where you wanted the Text widget to actually be. Normally when designing, when you want custom packing, you create a Frame (with it options properly set to expand) and pack your Text widget into the Frame. You can't just pack stuff into Frames and expect the layout to work. Most of the time you need nested Frames.
I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku ................... flash japh
Here is a simple example demonstrating the idea.
#!/usr/bin/perl use strict; use Tk; use Tk::Pane; my $mw = MainWindow->new; $mw->geometry( '400x250' ); my $mwf = $mw->Scrolled( 'Pane', -scrollbars => 'ose', -sticky => 'nwse', )->pack( -expand => 1, -fill => 'both' ); my $f1 = $mwf->Frame()->pack( -expand => 1, -fill => 'both' ); my $f2 = $mwf->Frame()->pack( -expand => 1, -fill => 'both' ); my %dudes; my $dude_count = 1; foreach my $fr($f1, $f2){ foreach (1..6){ $dudes{$dude_count}{'text'} = $fr->Text( -background => 'white', -foreground => 'black', -height => 10, -width => 22 )->pack(-side=>'left', -expand => 1, -fill => 'both' ); $dudes{$dude_count}{'text'}->insert('end', "\n Dude $dude_count\n") +; $dude_count++; } } MainLoop();
I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku ................... flash japh
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: tk positioning of widgets
by gibsonca (Beadle) on Oct 23, 2012 at 16:15 UTC | |
by zentara (Archbishop) on Oct 23, 2012 at 18:26 UTC | |
by Anonymous Monk on Oct 24, 2012 at 09:22 UTC |
In Section
Seekers of Perl Wisdom