Upon more reflection, it sounds like your app is like a spreadsheet. So I offer some code to get you started if you want to go that way. This is a bit different than packing your own widgets although you can do that!
The TableMatrix data structure is weird in that coordinates are "$row,$column" as a single hash key. Anyway here is some runnable code for you to play with...of course the details can get very complex! Like when you click on a square with left,right,middle mouse context and want pop-up menus and such.
Unless this critter has to be interactive with the user, I would suggest making a .CSV file or .XLS Excel file and using that for the display. Anyway here is a simple framework to make a Tk spreadsheet:
#!/usr/bin/perl -w
use strict;
use Tk;
use Tk::TableMatrix::Spreadsheet;
my %hash;
my $mw = MainWindow -> new;
$mw -> title ("Just Some Demo");
$mw ->Button(-text => "Quit!",
-command => sub {exit} ) ->pack;
my $top = $mw->Scrolled('Spreadsheet',
-rows => 21,
-cols => 11,
-width => 6,
-height => 12,
-titlerows => 1,
-titlecols => 0,
-variable => \%hash,
-selectmode => 'single',
-resizeborders => 'both',
-bg => 'white',
)->pack(-expand =>1, -fill=>'both');
$hash{"0,1"}="xyzzy";
$hash{"2,3"}="coord:2,3";
MainLoop;
Tk is cool and lot's can be done with it.
|