John M. Dlugosz has asked for the wisdom of the Perl Monks concerning the following question:
As for horizontal sizing, I got it to put all the new space in the rightmost column, which is what I wanted. I can't seem to do the same thing in the Y direction, though.
Can someone please help?
I've included the GUI part of my script.
use strict; use Tk; my $mw= new MainWindow::; my @version= (2,0,0,''); my $date= "21-Nov-2002"; my $option= 'analyze'; my ($directory)= "blah blah"; my $textbox; my $checkout_command= "foo bar %f"; sub params_box { my $top= $mw->Frame; my $f2= $top->Frame()->pack (-side=>'left', -anchor=>'n', -pady=>5); # Iteration/Revision/Patch info my $f1= $f2->Frame()->pack (-side => 'top', -pady=>2); $f1->Label (-text => "Iteration: ")->pack (-side => 'left'); $f1->Entry (-width=>3, -textvariable=>\$version[0] )->pack (-side => +'left'); $f1->Label (-text => "Revision: ")->pack (-side => 'left'); $f1->Entry (-width =>3, -textvariable=>\$version[2] )->pack (-side => + 'left'); $f1= $f2->Frame->pack (-side=>'top', -anchor=>'w', -pady=>2); $f1->Label (-text => "Patch Level: ")->pack (-side =>'left'); $f1->Entry (-width=>3, -textvariable=>\$version[3])->pack (-side=>'le +ft', -expand=>1, -fill=>'x'); # Release Date $f1= $f2->Frame->pack (-side => 'top', -pady=>2); $f1->Label (-text => "Release Date:")->pack (-side => 'left'); $f1->Entry (-width => 12, -textvariable=>\$date)->pack (-side => 'lef +t'); # make a stack of buttons $f2= $top->Frame()->pack(-side => 'left', -padx=>7, -pady=>5, -anchor +=>'n'); $f2->Button (-text => 'Go', -width => 10, -pady => 0, -command => \&g +o ) ->pack (-side => 'top', -expand => 1, -padx => 1, -pady => 1); $f2->Button (-text => 'Exit', -width => 10, -pady => 0, -command => \ +&exit ) ->pack (-side => 'top', -expand => 1, -padx => 1, -pady => 1); $f2->Button (-text => 'Clear', -width => 10, -pady => 0, -command => +sub{print OUTPUT "\x19"} ) ->pack (-side => 'top', -expand => 1, -padx => 1, -pady => 1); # the options $f2= $top->Frame (-relief=>'groove', -borderwidth=>2)->pack(-side=>'l +eft'); $f2->Radiobutton (-text => 'Check files out of Continuus', -value=>'c +heckout', -variable=>\$option) ->pack (-side => 'top', -anchor=>'w'); $f2->Radiobutton (-text => 'Defeat R attribute on read-only files', - +value=>'defeat', -variable=>\$option) ->pack (-side => 'top', -anchor=>'w'); $f2->Radiobutton (-text => 'analyze only (don\'t modify files)', -val +ue=>'analyze', -variable=>\$option) ->pack (-side => 'top', -anchor=>'w'); $f2->Radiobutton (-text => 'write different files (for testing)', -va +lue=>'temp', -variable=>\$option) ->pack (-side => 'top', -anchor=>'w'); # other fields $f2= $top->Frame()->pack(-side=>'right', -fill=>'x', -expand=>1, -anc +hor=>'n', -pady=>5); $f2->Label (-text => 'Working Directory:', -anchor=>'e') -> grid ( $f2->Entry (-textvariable=>\$directory), -sticky => 'ew'); $f2->Label (-text => 'CheckOut Command:', -anchor=>'e') -> grid ( $f2->Entry (-textvariable=>\$checkout_command), -sticky => 'ew'); $f2->gridColumnconfigure (1, -weight=>1); return $top; } sub setup_main_window { params_box()->pack (-side => 'top', -anchor=>'w', -expand=>1, -fill=> +'x'); $textbox= $mw->Scrolled ('ROText', -scrollbars=>'ose', -height=>20, - +width=>132) -> pack (-side=>'bottom', -expand=>1, -fill=>'both') ->Subwidget ('rotext'); } setup_main_window(); $textbox->insert ('end', "blah blah blah $_\n") for (1..50); MainLoop();
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Tk window panes not resizing the way I want
by traveler (Parson) on Nov 21, 2002 at 21:24 UTC | |
by John M. Dlugosz (Monsignor) on Nov 21, 2002 at 23:17 UTC | |
by traveler (Parson) on Nov 21, 2002 at 23:40 UTC | |
by John M. Dlugosz (Monsignor) on Nov 22, 2002 at 15:28 UTC |