#!/usr/bin/perl use strict; use warnings; use Tk; tk_main(); MainLoop(); exit; sub tk_main { my $mw = MainWindow->new(); $mw->title('Pack Layout 3'); =pod |------------------------------------------------| | Frame 1 | |------------------------------------------------| | Frame 2 | Frame 3 | Frame 4 | | |------------| | | | Frame 5 | | |------------------------------------------------| | Frame 6 | |------------------------------------------------| =cut my $frame1 = $mw->Frame( -borderwidth => 5, -background => 'blue', )->pack( -side => 'top', -expand => 1, -fill => 'both', ); my $frame6 = $mw->Frame( -borderwidth => 5, -background => 'red', )->pack( -side => 'bottom', -expand => 1, -fill => 'both', ); my $frame2 = $mw->Frame( -borderwidth => 5, -background => 'green', )->pack( -side => 'left', -expand => 1, -fill => 'both', ); my $frame4 = $mw->Frame( -borderwidth => 5, -background => 'cyan', )->pack( -side => 'right', -expand => 1, -fill => 'both', ); my $frame3 = $mw->Frame( -borderwidth => 5, -background => 'orange', )->pack( -side => 'top', -expand => 1, -fill => 'both', ); my $frame5 = $mw->Frame( -borderwidth => 5, -background => 'magenta', )->pack( -side => 'top', -expand => 1, -fill => 'both', ); $frame1->Label(-text => 'Frame 1')->pack(); $frame2->Label(-text => 'Frame 2')->pack(); $frame3->Label(-text => 'Frame 3')->pack(); $frame4->Label(-text => 'Frame 4')->pack(); $frame5->Label(-text => 'Frame 5')->pack(); $frame6->Label(-text => 'Frame 6')->pack(); }