Hello, I am running into a Tk issue with a large number of Tk::Label widgets within a scrolled Tk::Pane. After the widgets occupy some mysterious limit of "space", i.e. screen real estate, the widgets are no longer displayed correctly. Run the test code below and scroll all the way to the right until the last displayed Label. Swap the value of $txt to "fix" and "break" the display issue. The geometry manager used does not seem to make a difference (pack vs grid).
#!/usr/bin/perl use strict; use warnings; use Tk; use Tk::Pane; my $mw = MainWindow->new(); $mw->geometry('500x500'); my $pane = $mw->Scrolled( 'Pane', -scrollbars => 'se' )->pack( -side = +> 'left', -fill => 'both', -expand => 1 ); foreach my $col ( 1 .. 1000 ) { # try swapping the values of $txt below # my $txt = $col; # works my $txt = "Col $col"; # doesn't work # try swapping the geometry managers (same result) $pane->Label( -text => $txt, -relief => 'groove', -height => 20 )->g +rid( -row => 0, -column => $col ); # $pane->Label( -text => $txt, -relief => 'groove', -height => 20 )- +>pack( -side => 'left' ); } MainLoop;
As you see, when the width of the columns increases to accommodate the "Col" prefix to the label's text, the overall space occupied by all of the widgets increases and they stop being displayed at some point. When only the column number is displayed in the Label's text, there seems to be enough "room" and everything is rendered correctly. Is there some kind of maximum "scrolled space" beyond which Tk::Pane cannot handle? I am running perl v5.16.3 on RHEL 7.2 (don't ask)

In reply to 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.