I am not really sure about your exact requirements. I made a quick hack to show 2,000 columns with the TableMatrix widget below. There is a vast difference in how this looks vs your code. This scrolls quite easily on my machine. And there are options about how to format the title row with various border presentations and colors.

When I wrote the code that this was derived from more than decade ago, it had to run on a super wimpy lap top and I broke object encapsulation by writing the $tMain variable directly instead of calling the object's read/write methods for performance reasons. Very ugly, but it worked. You probably don't have to do that. If you do that, then the way that I caused a screen refresh was by setting the column widths again.

I am not sure from your code what you want in terms of appearance that cannot be done with TableMatrix?

use strict; use warnings; use Tk; use Tk::TableMatrix; use Data::Dump qw(pp); my $mw = MainWindow->new; $mw->configure(-title=> "Some Title"); $mw->geometry("1000x400+0+0"); my $table_frame = $mw->Frame(-height=>'10',-width=>'30', -relief=>'groove',-borderwidth=>'3' )->pack(-expand=>1, -fill=>'both',-pady=>'0'); my $tMain; my @col_heads = map{"col# $_";}0..1999; my $col =0; foreach my $heading (@col_heads) { $tMain->{"0,$col"} = "$heading"; $tMain->{"1,$col"} = "$heading"; $col++; } my $table = $table_frame->Scrolled('TableMatrix', -cols => scalar(@col_heads), -rows =>16, #fixed number of rows for this example # -width => 5, #minimum width in columns to be shown # -height => 10, #minimum number of rows to be shown - seems to limit! +! not Min! # -titlerows => 1, -variable => $tMain, # -selectmode => 'single', -state => 'disabled', # no direct editing of cells -resizeborders => 'col', -bg => 'white', # -rowheight => 2, -rowheight => 1, #make row display more compact.... -bd => [0,1,0,1], -justify => 'left', -drawmode => 'compatible', -wrap => 0, -relief => 'solid', -scrollbars=>'se', -exportselection =>0, )->pack(-expand =>1, -fill=>'both'); $table->rowHeight(0,2); #varies height of title row (0) #$table->tagRow('title',0); #$table->tagConfigure('title', -bd=>2, -relief=>'raised'); MainLoop;
Update: 100,000 cells is easy with this. Could you make a simple example with perhaps 10 labels to demo the kind of "look" that you are trying to achieve?
I really don't understand that this means: "I have 8,695 labels in a typical example (yes, I know) but the grid geometry manager is the only thing I can leverage which appropriately tracks their precise position/spacing in the layout which is very important to the data display.". I am completely unable to understand what this means from your posted example. I have sincere doubts about grid vs pack.

Update2: I suppose that Tk:Table might be appropriate for you? Tk::Table is an all-perl widget/geometry manager which allows a two dimensional table of arbitary perl/Tk widgets to be displayed.. I don't think so, but that might be true.


In reply to Re: Tk::Pane widget size limit? by Marshall
in thread Tk::Pane widget size limit? by jbuck

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.