CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
perl tk : How to store inputs from lable widget

 



r.ranjithme
New User

Oct 26, 2010, 4:28 AM

Post #1 of 2 (1987 views)
perl tk : How to store inputs from lable widget Can't Post

#! /usr/bin/perl -w
use Tk;
$filename = '1.txt';
$mw=MainWindow->new();
$s = $mw->Button(-text => "Save", -command => \&save_file)->pack(-side => 'right', -anchor => 'e');
foreach(1..5)
{
$mw->Entry()->pack;
}
MainLoop;


sub save_file
{
$info = "Saving '$filename\'";
open (FH, ">$filename");
print FH $s->get("1.0", "end");
$info = "Saved.";
}

In this code i want to store the inputs from lable widgets in to 1.txt file
Please reply ASAP
Thanks in advance
Crazy


BillKSmith
Veteran

Oct 26, 2010, 2:00 PM

Post #2 of 2 (1980 views)
Re: [r.ranjithme] perl tk : How to store inputs from lable widget [In reply to] Can't Post

The method get is a method of the entry widget, not the button. Save the Entry widgets in an array. Get the data from all five in the subroutine.
Good Luck,
Bill

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives