I have written the following:
#!/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;
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
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.