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