I seem to have hit some limit somewhere around 4000 labels in Perl/Tk. I'm using ActivePerl 813 on windows with 2GB of RAM. Here is the code. When I run this, you see the labels start turning yellow and then after that they stop showing up. So it's like I've maxed out and can't make anymore frames or labels?
#!/bin/perl
use Tk;
use Tk::Checkbutton;
use Tk::Button;
use File::Basename;
### Globals
$version=0.10;
$num_tasks=100;
$max_timeout=60;
################# START OF CODE ##################
my $mw=MainWindow->new;
$mw->title("my app: Version $version");
$mw->Label(-text=>"something\n\n")->pack;
my $mf = $mw->fontCreate('tiny',
-family=>'arial',
-size=>int(1));
$main_data_f = $mw->Frame(-background=>'red')->pack(-anchor=>'w');
foreach $i (1..$num_tasks) {
$main_data_task_f[$i] = $main_data_f->Frame()->pack(-side=>'left');
foreach $j (1..$max_timeout) {
#next if ($j>$i);
if ($j%2) {
if ($i%2) {
$test_bg = 'red';
} else {
$test_bg = 'blue';
}
} else {
if ($i%2) {
$test_bg = 'blue';
} else {
$test_bg = 'red';
}
}
if ($cnt++>3880) {$test_bg = 'yellow'};
$main_data_time_f[$i][$j] = $main_data_task_f[$i]->Frame()->pac
+k(-side=>'bottom');
$box[$i][$j] = $main_data_time_f[$i][$j]->Label(-font=>$mf, -ba
+ckground=>$test_bg)->pack();
}
}
MainLoop;
Justin Eltoft
"If at all god's gaze upon us falls, its with a mischievous grin, look at him" -- Dave Matthews
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.