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

Hi Monks,

I have written a code where I am executing a push button in perl TK.

I am copying a part of the code which I am having problem here. Here I have used a push button in the GUI and once I push the button in the GUI, it calls the sub-block push_button. I want to first print Execution in progress and then execute the code in the entireCode() function and then ask the user to check the FinalOut.txt file for results. Note that the entireCode sub-block takes about 15 minutes to run

sub push_button { $gdsname = $ent->get(); $gdsname ||= '?'; $txt->insert( 'end', "Execution in progress\n" ); entireCode(); $txt->insert( 'end', "Operation is successful. Check FinalOut.txt for +results.\n" ); }

But when I run the code, the entireCode sub-block runs. Then after 15 mins, In the text box I see

Execution in progress

Operation is successful. Check FinalOut.txt for results.

I want to first print out the execution in progress and then run the background task and once the background task ( entireCode function) is complete, print "operation successful. check FinalOut.txt"

Is there a way to do this? Or what might I be doing wrong? Can I somehow make the text be printed out in real time?

thanks,

Replies are listed 'Best First'.
Re: Perl Tk: Push button execution issue.
by Ganesh Bharadwaj1 (Sexton) on Aug 02, 2016 at 06:22 UTC
    Hi,

    I did not use

    $txt->update(); command.

    Once I used that, it works well.

    thanks,