CrashBlossom has asked for the wisdom of the Perl Monks concerning the following question:
My program is not behaving as expected, and I'm hoping you can explain why. I'm guessing it has something to do with the way I'm packing the frames, but I have tried many variations of the options and am still having problems.
My main window contains two frames, one on the left and one on the right. My intent is that when I widen the main window, the left frame will remain anchored to the left side of the main window and will not grow in X. This works as desired. The right frame is supposed to grow to fill all the area not used by the left frame. This does not happen. Although the right frame does expand some, its left side pulls away from the left frame, exposing an empty area of the main window.
Below is a complete program that demonstrates the problem.
I suspect it's something simple, but I can't figure it out. Can someone take a look and enlghten me?
Thanks!
use strict; use warnings; use Tk qw(MainLoop); my $mw = MainWindow->new( -bg => 'gold'); my $ctl = $mw->Frame(-borderwidth => 1, -relief => 'solid', -width => 300, -bg => 'aquamarine', )->pack(-fill=>'y', -expand=>1, -side=>'left', -anchor => 'w', ); my $cbox = $mw->Frame(-borderwidth => 1, -relief => 'solid', -width => 300, -height => 500, -bg => 'cornflowerblue', )->pack(-fill => "both", -expand => 1, -side=>'left', -anchor => 'w', ); + my $sfrm = $ctl->Frame()->pack(-fill=>'y', -expand=>0, -side=>'left' +,); $sfrm->Scale(-from => 255, -to => 0, )->pack(-fill=>'y', -expand=>1, -side=>'top',); MainLoop();
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Question about packing frames
by tybalt89 (Monsignor) on Oct 21, 2019 at 22:17 UTC | |
by CrashBlossom (Beadle) on Oct 21, 2019 at 23:02 UTC | |
by tybalt89 (Monsignor) on Oct 21, 2019 at 23:22 UTC | |
by CrashBlossom (Beadle) on Oct 21, 2019 at 23:47 UTC | |
by tybalt89 (Monsignor) on Oct 21, 2019 at 23:12 UTC |