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.

In reply to Re: Scrollable widgets by Marshall
in thread Scrollable widgets by samuelalfred

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.