G
greymaus
I am trying to find out what I am doing wrong with this test program,
when I hit return, the print in the sub getword outouts
Tk::Entry=HASH(0x8467234). using $word as a global gives the correct
answer, but is obviously unsatisfactory. Debian etch. Perl 5.8.8.
#!/usr/bin/perl -w
use Tk;
my $word='word';
$mw=MainWindow->new();
$mf0=$mw->Frame->grid();
$me=$mf0->Entry(-textvariable=>\$word);
$me->bind('<Key-Return>'=>[\&getword,$word]);
$ml=$mf0->Label(-text=>'Enter Word');
$mgo=$mf0->Button(-text=>'Go',-command=>[\&getword,$word])->grid($me,$ml);
$mf1=$mw->Frame->grid();
$mll=$mf1->Scrolled("Listbox",-width=>25,-height=>15)->grid();
$mf2=$mw->Frame->grid();
$mee=$mf2->Button(-text=>'Exit',-command=>sub{exit})->grid();
MainLoop;
sub getword(){
$d=shift;
print "$d\n";
}
when I hit return, the print in the sub getword outouts
Tk::Entry=HASH(0x8467234). using $word as a global gives the correct
answer, but is obviously unsatisfactory. Debian etch. Perl 5.8.8.
#!/usr/bin/perl -w
use Tk;
my $word='word';
$mw=MainWindow->new();
$mf0=$mw->Frame->grid();
$me=$mf0->Entry(-textvariable=>\$word);
$me->bind('<Key-Return>'=>[\&getword,$word]);
$ml=$mf0->Label(-text=>'Enter Word');
$mgo=$mf0->Button(-text=>'Go',-command=>[\&getword,$word])->grid($me,$ml);
$mf1=$mw->Frame->grid();
$mll=$mf1->Scrolled("Listbox",-width=>25,-height=>15)->grid();
$mf2=$mw->Frame->grid();
$mee=$mf2->Button(-text=>'Exit',-command=>sub{exit})->grid();
MainLoop;
sub getword(){
$d=shift;
print "$d\n";
}