Hello Monks,

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();

In reply to Question about packing frames by CrashBlossom

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.