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

In reply to Re: Problem refreshing TK window after file update by zentara
in thread Problem refreshing TK window after file update by CorpusDawg

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.