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.
In reply to Tk "hello, world", part 2 by RandomWalk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |