in reply to Re: Printing text from scrolled window?
in thread Printing text from scrolled window?
Like Fletch asked, why separate the lines from the widget? I combined the code and ran it, and it worked fine without splitting the lines.
#!/usr/bin/perl -w use strict; use Tk; my $maincolor='red'; my $mw = MainWindow->new; $mw->minsize(qw(250 200)); #x y $mw->configure(-title=>'PROGRAM', -background=>$maincolor); my $frame_1=$mw->Frame(-borderwidth => 3, -background => $maincolor)-> +pack( -side=>'top', -fill=>'x'); $frame_1->Label(-text => 'Scroll', -background=>'yellow',)->pack(-side + =>'left'); my $scroll=$mw->Scrolled("Text", -scrollbars => 'e', -width => 10, -he +ight => 10,)->pack; my $frame_2=$mw->Frame(-borderwidth => 3, -background => $maincolor)-> +pack( -side=>'top', -fill=>'x'); $frame_2->Button( -text => 'Print', -width=>7, -command=>\&doPrint )->pack(-side =>'bottom'); MainLoop; sub doPrint { #my @lines = split /\n/, $scroll->Contents (); #print join "\n", @lines; my $lines = $scroll->Contents(); print $lines; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Printing text from scrolled window?
by GrandFather (Saint) on Jul 28, 2006 at 18:55 UTC | |
by Fletch (Bishop) on Jul 28, 2006 at 19:11 UTC |