RandomWalk has asked for the wisdom of the Perl Monks concerning the following question:
I can run hello.pl as in Tk Tutorial but am having a little trouble with the next step. For instance, I would like to get input from an Entry widget instead of STDIN. I thought this should work but I'm not getting assigned as I expected:
Results only inmy $main = MainWindow->new(); $main->Label(-text=>"Company Name:")->pack(); my $entry = $main->Entry()->pack; $entry->focus(); my $name = $entry->get(); $main->Button(-text=>"Continue", -command=> sub {$main->destroy})->pac +k(); $main->Button(-text=>"Cancel", -command => sub {exit})->pack(); $main->bind('<Return>' => sub {$main->destroy}); MainLoop; die "$name";
$ perl new_invoice.pl Died at new_invoice.pl line 38.
I guess when this works I'll try to make it more attractive with fonts and geometry management, and then maybe continue with the tutorial or "Mastering Perl/Tk".
I would appreciate any guidance. Thanks.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Tk "hello, world", part 2
by arden (Curate) on Jan 29, 2004 at 20:51 UTC | |
by RandomWalk (Beadle) on Jan 29, 2004 at 21:31 UTC | |
|
Re: Tk "hello, world", part 2
by Rhose (Priest) on Jan 29, 2004 at 20:46 UTC |