The code below does what you want, but be advised dumping alot of text into a Label widget may not be what you want, a Text widget may be better. See Insert something like a hyperlink in a Tk Text widget
The reason your code dosn't work, is you didn't define $memWindow anywhere, and you didn't pack your labels. If you don't pack them, or use another geometry manager, the labels lay hidden behind the scenes. Also see: linux memory leak monitor for a good example of what you may be looking for. Be aware, that you shouldn't use system, or sleep, or anything which blocks the eventloop in GUI's. It is better to fork or use a pipe to run commands.#!/usr/bin/perl use Tk; use strict; my $mw = MainWindow->new; my $buf; open (FH,"< $0"); read( FH, $buf, -s FH ); close FH; my $label = $mw->Label( -textvariable => \$buf, -background => 'black', -fg=>'yellow', )->pack; MainLoop;
In reply to Re: Problem creating Tk::Label widgets from file data
by zentara
in thread Problem creating Tk::Label widgets from file data
by coder_perl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |