I would hazard an educated guess that the scrollbars introduce a minimum size. To test this theory, I rewrote your script without the Notebook, to take that unknown out of the equation. Notice when I set the scollbars to 'oooo' ( no scrollbars), the frames are the same, but they differ when scrollbars are allowed ( 'osoe')
#!/usr/bin/perl use warnings; use strict; use Tk; use Tk::Pane; my $mw = tkinit; my $f1 = make_frame( $mw, 'green', 'noscroll', 'top', 0, 'both' ); my $f2 = make_frame( $mw, 'blue', 'scrolled', 'top', 0, 'both' ); # Populate frames with subframe containing a label and a button. # Attempt to pack the subframe into the "top" of the containing widget +. label_button_frame( $f1, 'gold' ); # Packs as expected label_button_frame( $f2, 'red' ); # Fails to pack nicely?? # Manage gui MainLoop; # Subroutines sub make_frame { my ( $parent, $bgcolor, $scrolled, $side, $expand, $fill ) = @_; my $b_scr = ( $scrolled eq 'scrolled' ) ? 1 : 0; my $frame = $b_scr ? $parent->Scrolled( 'Frame', -scrollbars => 'oooo' ) : $parent->Frame(); # -scrollbars=>'osoe'): $parent->Frame(); $frame->configure( -bg => $bgcolor ); $frame->pack( -side => $side, -expand => $expand, -fill => $fill ); return $frame; } sub label_button_frame { my ( $parent, $bgcolor ) = @_; my $mw = $parent->toplevel(); my $fr = make_frame( $parent, $bgcolor, 'noscroll', 'top', 1, 'x' ) +; $fr->configure( -relief => 'groove', -borderwidth => 4 ); $fr->Label( -text => 'My Label', -rel => 'groove' )->pack( -side => + 'left' ); my $pcmd = sub { $mw->destroy }; $fr->Button( -text => 'Exit', -command => $pcmd )->pack( -side => ' +right' ); return $fr; }

I'm not really a human, but I play one on earth. Cogito ergo sum a bum

In reply to Re: Undesired behavior using the Scrolled method in Tk by zentara
in thread Undesired behavior using the Scrolled method in Tk by liverpole

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.