D
doni
Hi,
I am right now learning about Perl/TK and have a basic question
regarding subroutines and callbacks.
I was wondering how can I have the subroutine output to display in the
MainWindow if the subroutine is called using a button widget from the
MainWindow.
Here is the code that I wrote to test my above question.
#!/usr/bin/perl
use strict;
use Tk;
my $mw = MainWindow->new;
$mw->title("Demo Program");
$mw->Button(-text => "Test",
-command => sub{test()})->pack;
$mw->Button(-text => "Exit",
-command => sub{exit})->pack;
MainLoop;
sub test {
print "We have reached the subroutine part \n";
}
button.
When I press the "Test" button the result is getting displayed on the
command line and not on the MainWindow.
Thanks,
doni
I am right now learning about Perl/TK and have a basic question
regarding subroutines and callbacks.
I was wondering how can I have the subroutine output to display in the
MainWindow if the subroutine is called using a button widget from the
MainWindow.
Here is the code that I wrote to test my above question.
#!/usr/bin/perl
use strict;
use Tk;
my $mw = MainWindow->new;
$mw->title("Demo Program");
$mw->Button(-text => "Test",
-command => sub{test()})->pack;
$mw->Button(-text => "Exit",
-command => sub{exit})->pack;
MainLoop;
sub test {
print "We have reached the subroutine part \n";
}
subroutine part" to display in the MainWindow when I press the "test"From the above code, I wanted the print statement "We have reached the
button.
When I press the "Test" button the result is getting displayed on the
command line and not on the MainWindow.
Thanks,
doni