my $mw = MainWindow->new;
$mw->geometry ('640x480');
# The overall layout of the window will look like:
# [=============]
# [ ][xxx]
# [ ][xxx]
# [ ][xxx]
# where =, , and x are three different frames,
# and = and x won't resize themselves when the
# window resizes, but the big widget will.
# The top frame ([===]) goes at the top of the window
# and fills across horizontally.
my $topFrame = $mw->Frame->pack (-side => 'top', -fill => 'x');
# This wrapper frame will contain the large frame
# and the [xxx] frame.
my $wrapperFrame = $mw->Frame->pack (-side => 'top', -fill => 'both', -expand => 1);
# The right frame goes within the wrapper frame.
my $rightFrame = $wrapperFrame->Frame->pack (-side => 'right', -fill => 'y');
# The main frame also goes in the wrapper frame.
my $mainFrame = $wrapperFrame->Frame->pack (-side => 'right', -fill => 'both', -expand => 1);
# Now create a few widgets in each frame.
$topFrame->Label (
-text => 'Just a simple label',
)->pack (-side => 'left');
$topFrame->Button (
-text => 'And a button',
)->pack (-side => 'left');
$rightFrame->Label (
-text => "The width of this label\n"
. "will ultimately\n"
. "control the width\n"
. "of the right frame.",
)->pack (-side => 'top');
$mainFrame->Scrolled ('Text',
-scrollbars => 'osoe',
)->pack (-fill => 'both', -expand => 1);