in reply to Printing File Onto Tk::Label

Just in case you have a legitimate need to put a file onto a label, here are a few tips. You need to watch your -wraplength, -anchor, and -justify.

I suppose for small files, that you want to display readonly, and don't want the overhead of the full Text widget, a Label might be a good choice for display.

#!/usr/bin/perl use strict; use Tk; my $mw = Tk::MainWindow->new(); #open this script as an example open( my $fh,"< $0" ) or die "$!\n"; my $buf; read( $fh, $buf, -s $fh ); close $fh; my $lab1=$mw->Label(-text => 'abc abc abc abc abc abc abc abc abc abc +abc abc', -bg=>'white', -width => 40, -wraplength => 200, )->pack(-expand=> 0, -fill=> 'x'); my $lab2=$mw->Label(-text => 'abc abc abc abc abc abc abc abc abc abc +abc abc', -bg=>'lightblue', -width => 40, -wraplength => 100, )->pack(-expand=> 0, -fill=> 'x'); my $lab3=$mw->Label(-text => $buf, -bg=>'hotpink', -width => 40, -wraplength => 200, -justify => 'left', -anchor => 'w', )->pack(-expand=> 0, -fill=> 'x'); MainLoop;

I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku ................... flash japh