Hello All,
I've got a program I'm writing using Perl/Tk. The whole point of the program is to go on the web fetch some stock information and return it. The program works execpt for a mere annoyance. While the program is retrieving the data I would like to have a label saying something along the lines of "Retrieving Data" and then clearing the message away after the data has been retrieved.. During the course of debugging and trying to figure out what was going on I found that not only is the message not displaying, but the button used to call the subroutines to get data, depresses and stays depressed until the subroutine exits. I wrote a smaller, simpler program to try and help debug the problem:
So what I would like to happen is when the button is pressed the message label changes to "Loading" until the counter counts all the way to 0, then the message changes to "Done". What happens when I run it is the button gets depressed and stays depressed until the counter has counted down then the message immediatly changes to "Done". I have put a "print "Made it here\n"" line in the loading subroutine and the program is executing that subroutine.
Thanks ahead of time for any help and I apologize if there are any problems with this post, this is the first time I've used a message board.
Thanks,
Tim
I've got a program I'm writing using Perl/Tk. The whole point of the program is to go on the web fetch some stock information and return it. The program works execpt for a mere annoyance. While the program is retrieving the data I would like to have a label saying something along the lines of "Retrieving Data" and then clearing the message away after the data has been retrieved.. During the course of debugging and trying to figure out what was going on I found that not only is the message not displaying, but the button used to call the subroutines to get data, depresses and stays depressed until the subroutine exits. I wrote a smaller, simpler program to try and help debug the problem:
Code:
use strict;
use warnings;
use Tk;
my $main = MainWindow->new;
my $message = "Some text";
init();
MainLoop();
sub loopstuff()
{
loading();
my $count = 10000000;
while($count > 0)
{$count--;}
done();
}
sub loading
{$message = "Loading";}
sub done
{$message = "Done";}
sub init
{
my $frame = $main->Frame;
$frame->Label(-textvariable => \$message)->pack();
$frame->Button(-text => "ok", -command => \&loopstuff)->pack();
$frame->Button(-text => "cancel", -command => \&exit)->pack();
$frame->pack();
}
So what I would like to happen is when the button is pressed the message label changes to "Loading" until the counter counts all the way to 0, then the message changes to "Done". What happens when I run it is the button gets depressed and stays depressed until the counter has counted down then the message immediatly changes to "Done". I have put a "print "Made it here\n"" line in the loading subroutine and the program is executing that subroutine.
Thanks ahead of time for any help and I apologize if there are any problems with this post, this is the first time I've used a message board.
Thanks,
Tim