tamaguchi has asked for the wisdom of the Perl Monks concerning the following question:
I have written the following:
The point is that there should be a scrolled window in which it is possible to directly write things. In my code the window it is of "Text"-type (but I´m not sure if others could be better). Now I would like to make it possible to print the text entered in the scolled window by clicking the "print" button, but I dont know how to do this, could you help me? Preferably (if it is possible) the text could be extracted as an array so that each line in the scrolled window is an ellement in the array. Thank you for any help#!/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=>sub{})->pack(- +side =>'bottom'); MainLoop;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Printing text from scrolled window?
by GrandFather (Saint) on Jul 28, 2006 at 10:44 UTC | |
by Fletch (Bishop) on Jul 28, 2006 at 13:00 UTC | |
by GrandFather (Saint) on Jul 28, 2006 at 18:42 UTC | |
by Fletch (Bishop) on Jul 28, 2006 at 19:00 UTC | |
by jdtoronto (Prior) on Jul 28, 2006 at 17:34 UTC | |
by GrandFather (Saint) on Jul 28, 2006 at 18:55 UTC | |
by Fletch (Bishop) on Jul 28, 2006 at 19:11 UTC | |
Re: Printing text from scrolled window?
by reneeb (Chaplain) on Jul 28, 2006 at 10:30 UTC | |
by tamaguchi (Pilgrim) on Jul 28, 2006 at 10:40 UTC |
Back to
Seekers of Perl Wisdom