llancet has asked for the wisdom of the Perl Monks concerning the following question:

I have a callback that will spend a pretty long time to run, and I want to have a button, which can be pressed to stop that callback. However, while in a callback, the interface stops respond. So, how can I achieve that?
  • Comment on Tk problem: keep sober while in callback

Replies are listed 'Best First'.
Re: Tk problem: keep sober while in callback
by vkon (Curate) on Sep 28, 2008 at 08:15 UTC
    during your lengthy calculations call sometimes
    $widget->update;
    that's all.
Re: Tk problem: keep sober while in callback
by zentara (Cardinal) on Sep 28, 2008 at 13:13 UTC
    As vkon said, liberally sprinking $mw->update in your callback, will keep the gui responsive, usually. But some callbacks can take along time on a single step, so the update method won't work. You need to tell us what is in your callback.....you may need to fork it off or put it into a thread for maintaining Tk responsiveness.

    I'm not really a human, but I play one on earth Remember How Lucky You Are
Re: Tk problem: keep sober while in callback
by Anonymous Monk on Sep 28, 2008 at 07:15 UTC
Re: Tk problem: keep sober while in callback
by Anonymous Monk on Sep 28, 2008 at 07:19 UTC