in reply to Re: Perl Tk Asynchronous Progress Updates
in thread Perl Tk Asynchronous Progress Updates

Thanks for the tip. I tried Tk::After, but that doesn't seem to work. Perhaps I misunderstood the cpan page. The modified code is below.

my $button=$mw->Button(-text=>'Update'); $button->after(0, [\&update, \$prog ]); $button->pack; $mw->ProgressBar(-variable=>\$prog)->pack;

For some reason the callback function is now executed immediately after the script is run (and still not asynchronously), rather than after the button event. Any help would be much appreciated.

Thanks

Replies are listed 'Best First'.
Re^3: Perl Tk Asynchronous Progress Updates
by BrowserUk (Patriarch) on Jul 01, 2013 at 22:05 UTC
    For some reason the callback function is now executed immediately... $button->after(0, [\&update, \$prog ]);

    What do you think that 0 (zero) that you have as the first argument to ->after() means?


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.
      When I said "immediately" I mean't before the gui is run as opposed to after a button is clicked. I assumed (it appears incorrectly) that tieing the callback via "after" from the button widget would only result in execution upon the widget's activation (button click). This is still my ultimate goal.