I am not an expert but, as far as I understand MainLoop services all of the widgets sequentially. If you call a sub which has a while loop there will be no widget Text updates until that loop is finished and MainLoop has had chance to get around the widgets again to update them.
The only way around that I am aware is to run the Tk stuff as a separate thread to the while loop.
There are some articles on threads
http://search.cpan.org/~
Starting with these I have managed to get one running with a simple counter looping endlessly while a Tk gui is running. It runs on activestate 5.8.4.
I can send you the script if it is any use.
Message
From: bmezian
To: beginning_perl_tk (AT) yahoogroups (DOT) com
Sent: Friday, May 06, 2005 10:36 PM
Subject: [Beginning Perl/Tk] Help with program output updates written to a TK window
Hello all,
the Win32 platform using active State 5.8x, I have a program that
while processing a file, writes updates to a text widget, with
processing beginning by a command subroutine from a buton press:
$f ->Button(-text ="Process New",
-font ='tahoma 8 bold',
-activebackground ='#D0C36B',
-command =\&process_data_file)
->pack(-side ='left', -expand =1, -fill ='x', -
pady =1, -anchor ='w');
The callback to the RText widget is:
$t->insert("end", "Adding ". $dlrstnum . " " . $year . " " .
$make . " " . $model . "\n");
called from within a while loop. My problem is this, the screen
display only updates after all of the processing has finished,
rather than writing each line out to the window as it is being
processed.
Can anyone help with a suggestion on how to get the screen display
to update as the file is processing? The behavior is also the same
using a progress bar, and output from a ping command to the same
text widget.
Thanks for any help!
Yahoo! Groups Links
a To visit your group on the web, go to:
b To unsubscribe from this group, send an email to:
beginning_perl_tk-unsubscribe (AT) yahoogroups (DOT) com
c Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service