#!/usr/bin/perl
# https://perlmonks.org/?node_id=1218559
use strict;
use warnings;
use Tk;
use Tk::LabFrame;
#use Tk::Treeplus;
use Tk::ErrorDialog;
my $mw = MainWindow->new();
my $gridOrPack="grid"; #"pack";
#my $gridOrPack="pack";
#my $tpFrame;
#my $butFrame;
my $tpFrame=$mw->LabFrame(-label=>'TreePlusFrame');
my $butFrame=$mw->LabFrame(-label=>'ButtonFrame');
if ($gridOrPack=~/grid/i) {
$tpFrame->grid(-row=>1, -column=>1, -sticky=>'nsew');
$butFrame->grid(-row=>2, -column=>1, -sticky=>'nsew');
$mw->gridRowconfigure( 1, -weight => 1 );
$mw->gridRowconfigure( 2, -weight => 1 );
$mw->gridColumnconfigure( 1, -weight => 1 );
}
else {
$tpFrame->pack(-side=>'top',-expand=>1,-fill=>'both');
$butFrame->pack(-side=>'top',-expand=>1, -fill=>'both');
}
$tpFrame->Label(-text=>'I like pack better')->pack(-side=>'top');
$butFrame->Button(
-text => 'Exit',
-command => sub { exit(0) },
)
->pack(qw(-side bottom -pady 10));
MainLoop();