Reading all input from a Text Widget into an Array? 
Author Message
 Reading all input from a Text Widget into an Array?

Hello Everyone,

      I'm sure this question has been asked before, however I could
not find much related to this subject under archives. Anyways, the
problem is that I'm trying to read all the input lines from a text

$textbox->get(1.0, end);"

  It failed. I don't know what else to think about. Any help will be
much appreciated. Thank You.

PS. Here is the actual code.

$frm_body = $mw->Frame() ->pack( -padx => 10, -pady => 5, -side =>
right);




Sat, 26 Mar 2005 05:54:18 GMT  
 Reading all input from a Text Widget into an Array?

Quote:

> Hello Everyone,

>       I'm sure this question has been asked before, however I could
> not find much related to this subject under archives. Anyways, the
> problem is that I'm trying to read all the input lines from a text

> $textbox->get(1.0, end);"

>   It failed. I don't know what else to think about. Any help will be
> much appreciated. Thank You.

> PS. Here is the actual code.

> $frm_body = $mw->Frame() ->pack( -padx => 10, -pady => 5, -side =>
> right);
> $txt = $frm_body->Text( -width => 60, -height => 23)->pack;


It *should* work.

Regards,
        Slaven

--

need xpm or ppm output from GD?
        http://search.cpan.org/search?mode=module&query=GD::Convert



Sat, 26 Mar 2005 07:01:37 GMT  
 Reading all input from a Text Widget into an Array?

Quote:


> > Hello Everyone,

> >       I'm sure this question has been asked before, however I could
> > not find much related to this subject under archives. Anyways, the
> > problem is that I'm trying to read all the input lines from a text

> > $textbox->get(1.0, end);"

> >   It failed. I don't know what else to think about. Any help will be
> > much appreciated. Thank You.

> > PS. Here is the actual code.

> > $frm_body = $mw->Frame() ->pack( -padx => 10, -pady => 5, -side =>
> > right);
> > $txt = $frm_body->Text( -width => 60, -height => 23)->pack;

> It *should* work.

> Regards,
>    Slaven

Hi Slaven,

  Well yea. That's what I thought, however is not. I tried everything
under this world, I don't know what else to try. I'm using Perl 5.80
under Redhat 8.0 linux. Anyway, I'm going to post the full program as
it is currently. Basically, is a front-end (GUI) to sendmail. Please
any suggestions, tips, or anything to help me solve this problem is
welcome. Thank you.

#!/usr/bin/perl
use Tk;
#Mandador v0.3

#VARIABLE LIBRARY. *NOTE* CHANGE SENDMAIL PATH IF NEEDED.
$sendmailpath = "/usr/sbin/sendmail";

#SENDMAIL PROCESS.
sub sendmail {
open (SENDMAIL, "| $sendmailpath -t");
print SENDMAIL "Subject: $input_subject\n";
print SENDMAIL "From: \"$input_s_name\" \<$input_s_address\>\n";
print SENDMAIL "To: $input_to\n\n";

close (SENDMAIL);

Quote:
}

#WINDOW CREATION PROCESS.
$mw = new MainWindow;
$mw->title( "Mandador v0.0.1" );

$frm_body = $mw->Frame() ->pack(-padx => 10, -pady => 40, -side =>
right, -anchor => 'n');
$txt = $frm_body->Text(-background => white, -relief => ridge, -width

$md = $mw->Label(-foreground => gray95, -text => "Mandador v.0.0.1\nby
Miguel Daniel") ->pack;

$frm1 = $mw->Frame() ->pack( -padx =>10, -pady => 5, -side => top,
-anchor => nw);
$t_label = $frm1->Label(-text => "Target E-mail  ") ->pack;
$t_entry = $frm1->Entry(-background => white, -textvariable =>
\$input_to) ->pack;

$frm2 = $mw->Frame() ->pack( -padx =>10, -pady => 5, -side => top,
-anchor => nw);
$tp_label = $frm2->Label(-text => "E-mail Subject  ") ->pack;
$tp_entry = $frm2->Entry(-background => white, -textvariable =>
\$input_subject) ->pack;

$frm3 = $mw->Frame() ->pack( -padx =>10, -pady => 5, -side => top,
-anchor => nw);
$inp_n_label = $frm3->Label(-text => "Your Full Name  ") ->pack;
$inp_n_entry = $frm3->Entry(-background => white, -textvariable =>
\$input_s_name) ->pack;

$frm4 = $mw->Frame() ->pack( -padx =>10, -pady => 5, -side => top,
-anchor => nw);
$inp_s_label = $frm4->Label(-text => "Sender's E-mail  ") ->pack;
$inp_s_entry = $frm4->Entry(-background => white, -textvariable =>
\$input_s_address) ->pack;

$frm_bu = $mw->Frame() ->pack( -pady => 5, -side => top);
$frm_bu->Button(-text => " Send ",
-relief => groove,
-command => sub {  &sendmail } ) ->pack (-ipadx =>40, -ipady => 2,
-padx =>10, -pady => 2);
$frm_bu->Button(-text => "  Exit  ",
-relief => groove,
-command => sub {  exit } ) ->pack(-ipadx =>40, -ipady => 2, -padx
=>10, -pady => 2);

$frm_status = $mw->Frame() ->pack( -padx => 5, -pady => 5, -anchor =>
sw);
$status = $frm_status->Label(-text => "Status: ") ->pack;

MainLoop;

Sincerely,
Miguel Daniel



Sun, 27 Mar 2005 08:01:34 GMT  
 Reading all input from a Text Widget into an Array?
Hi Miguel!

In short - you must read textbox content in callback function and not just after
textbox definition (when it really empty!)

Regards,
       Felix.da.ru

Quote:



> > > Hello Everyone,

> > >       I'm sure this question has been asked before, however I could
> > > not find much related to this subject under archives. Anyways, the
> > > problem is that I'm trying to read all the input lines from a text

> > > $textbox->get(1.0, end);"

> > >   It failed. I don't know what else to think about. Any help will be
> > > much appreciated. Thank You.

> > > PS. Here is the actual code.

> > > $frm_body = $mw->Frame() ->pack( -padx => 10, -pady => 5, -side =>
> > > right);
> > > $txt = $frm_body->Text( -width => 60, -height => 23)->pack;

> > It *should* work.

> > Regards,
> >       Slaven

> Hi Slaven,

>   Well yea. That's what I thought, however is not. I tried everything
> under this world, I don't know what else to try. I'm using Perl 5.80
> under Redhat 8.0 linux. Anyway, I'm going to post the full program as
> it is currently. Basically, is a front-end (GUI) to sendmail. Please
> any suggestions, tips, or anything to help me solve this problem is
> welcome. Thank you.

> #!/usr/bin/perl
> use Tk;
> #Mandador v0.3

> #VARIABLE LIBRARY. *NOTE* CHANGE SENDMAIL PATH IF NEEDED.
> $sendmailpath = "/usr/sbin/sendmail";

> #SENDMAIL PROCESS.
> sub sendmail {
> open (SENDMAIL, "| $sendmailpath -t");
> print SENDMAIL "Subject: $input_subject\n";
> print SENDMAIL "From: \"$input_s_name\" \<$input_s_address\>\n";
> print SENDMAIL "To: $input_to\n\n";

> close (SENDMAIL);
> }

> #WINDOW CREATION PROCESS.
> $mw = new MainWindow;
> $mw->title( "Mandador v0.0.1" );

> $frm_body = $mw->Frame() ->pack(-padx => 10, -pady => 40, -side =>
> right, -anchor => 'n');
> $txt = $frm_body->Text(-background => white, -relief => ridge, -width
> => 60, -height => 25, -wrap=>'word')->pack;

> $md = $mw->Label(-foreground => gray95, -text => "Mandador v.0.0.1\nby
> Miguel Daniel") ->pack;

> $frm1 = $mw->Frame() ->pack( -padx =>10, -pady => 5, -side => top,
> -anchor => nw);
> $t_label = $frm1->Label(-text => "Target E-mail  ") ->pack;
> $t_entry = $frm1->Entry(-background => white, -textvariable =>
> \$input_to) ->pack;

> $frm2 = $mw->Frame() ->pack( -padx =>10, -pady => 5, -side => top,
> -anchor => nw);
> $tp_label = $frm2->Label(-text => "E-mail Subject  ") ->pack;
> $tp_entry = $frm2->Entry(-background => white, -textvariable =>
> \$input_subject) ->pack;

> $frm3 = $mw->Frame() ->pack( -padx =>10, -pady => 5, -side => top,
> -anchor => nw);
> $inp_n_label = $frm3->Label(-text => "Your Full Name  ") ->pack;
> $inp_n_entry = $frm3->Entry(-background => white, -textvariable =>
> \$input_s_name) ->pack;

> $frm4 = $mw->Frame() ->pack( -padx =>10, -pady => 5, -side => top,
> -anchor => nw);
> $inp_s_label = $frm4->Label(-text => "Sender's E-mail  ") ->pack;
> $inp_s_entry = $frm4->Entry(-background => white, -textvariable =>
> \$input_s_address) ->pack;

> $frm_bu = $mw->Frame() ->pack( -pady => 5, -side => top);
> $frm_bu->Button(-text => " Send ",
> -relief => groove,
> -command => sub {  &sendmail } ) ->pack (-ipadx =>40, -ipady => 2,
> -padx =>10, -pady => 2);
> $frm_bu->Button(-text => "  Exit  ",
> -relief => groove,
> -command => sub {  exit } ) ->pack(-ipadx =>40, -ipady => 2, -padx
> =>10, -pady => 2);

> $frm_status = $mw->Frame() ->pack( -padx => 5, -pady => 5, -anchor =>
> sw);
> $status = $frm_status->Label(-text => "Status: ") ->pack;

> MainLoop;

> Sincerely,
> Miguel Daniel



Sun, 17 Apr 2005 20:40:39 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Read Text Widget into Array (PERL TK)

2. Trailing file input to Tk text widget

3. Reading all user input from a Text Widget into an Array?

4. reading text field input

5. Read-only text widget tags.

6. text widget read-only?

7. Read-only Text Widget...

8. Print an array in a text widget

9. Reading text file lines into an array

10. cr's in input text fields screwing up the database (not text area)

11. Read text file to array

12. Q: Changing Text-Color in Text-Widget?

 

 
Powered by phpBB® Forum Software