#!/usr/bin/perl use strict; # https://perlmonks.org/?node_id=11136705 use warnings; use Tk; use Tk::Pane; my $mw = MainWindow->new(); $mw->geometry("+0+0"); $mw->maxsize(1000,1200); $mw->minsize(400,300); my $scroll = $mw->Scrolled('Pane', -scrollbars => 'osoe', -sticky => 'news', )->pack(-expand => 1, -fill => 'both'); my $f = $scroll->Frame->pack(-expand => 1, -fill => 'both'); foreach my $row (0..10) { foreach my $col (0..12) { $f->Entry( -text => "rc $row $col", -width => 0, )->grid(-row => $row, -column => $col, -sticky => 'news'); $row or $f->gridColumnconfigure($col, -weight => 1); } $f->gridRowconfigure($row, -weight => 1); } # example of ->pack in a different Frame my $buttonbar = $mw->Frame(-bg => 'blue', )->pack(-fill => 'x'); $buttonbar->Button(-text => 'Exit', -command => sub{$mw->destroy}, )->pack(-side => 'right', -fill => 'x', -expand => 1); $buttonbar->Button(-text => ' Another Noop', )->pack(-side => 'right', -fill => 'x', -expand => 1); $buttonbar->Button(-text => 'Noop', )->pack(-side => 'right', -fill => 'x', -expand => 1); MainLoop; -M $0 < 0 and exec $0; # FIXME for testing