in reply to Problem refreshing TK window after file update

Without the data you are using it is hard to give you a good answer, because I can't run the code. But.....

It appears to me you are updating all wrong, and you will probably be creating a "memory-leak" as you run the program. Not a memory-leak in the true sense of debugging c, but you will find your Tk program MAY be consuming more and more memory as it runs for a long period of time.

The main problem is you are repeatedly destroying and creating widgets to update them. This causes Tk to grow in size.

What you should do is create the $metstat* and $adcpstat* Entry widgets one time in the main portion of your program, and then in the sub array_update you just update the Entry widgets. Something along these lines:

sub array_update { open (FILE, $statfile) || die "Couldn't open file: $!"; my @statarray = <FILE>; close FILE; foreach (@statarray){chomp;} $metstat1"->configure(-textvariable => \$statarray[0]); $metstat2"->configure(-textvariable => \$statarray[1]); $metstat3"->configure(-textvariable => \$statarray[2]); $metstat4"->configure(-textvariable => \$statarray[3]); $metstat5"->configure(-textvariable => \$statarray[4]); $adcpstat1"->configure(-textvariable => \$statarray[5]); $adcpstat2"->configure(-textvariable => \$statarray[6]); $adcpstat3"->configure(-textvariable => \$statarray[7]); $adcpstat4"->configure(-textvariable => \$statarray[8]);
Although you may be able to get away with a simple $main->update since you are using -textvariable in the Entry widgets.

Also you may have to make the $metstat* $adcpstat* variables global, to access from the sub. (That is the easiest way).


I'm not really a human, but I play one on earth. flash japh