Hi, I am looking for code examples (or snippets) of Perl/TK Hlists or tables that perform periodic auto-refreshing of table rows (e.g., perhaps using the $widget->repeat/entryconfigure functions?)

I'm interested in displaying a table that auto-updates every N seconds. For example, here is a trivial TK/HList that produces a STATIC display of the current set of running processes. I'd like to explore versions of this code where the Hlist rows autoupdate every N seconds (e.g., row attributes update, rows disappear, rows are added). One could do this by cycling through MainWindow->new / MainWindow->destroy / MainWindow->new, but that's very clunky and causes table flashing.

use Tk; use Tk::HList; use Win32::ToolHelp; my @plist; my $col = 0; &getprocHash(); my $mw = MainWindow->new; $mw->resizable(1,1); $mw->title("static process list"); $mw->geometry("400x250+80+100"); my $hlist = $mw->HList(-columns=>5, -header=>1, -background=>"white", -command=>, -browsecmd=>,-selectmode=> 'single')->pack(-fill=>'both', -expand=>'yes'); foreach my $label (qw/PID Threads AID Priority Name/) { $hlist->header('create',$col++,-itemtype=>'text',-text=>$label) ; } foreach my $p (@plist) { my $e = $hlist->addchild(""); $col = 0; foreach $i (1,4,5,6,8) { $hlist->itemCreate($e,$col++, -itemtype=>'text',-text=>"$$p[$i]"); } } MainLoop; exit (0); sub getprocHash { @plist = Win32::ToolHelp::GetProcesses(); }

In reply to Auto-refreshing Perl TK HLists/Tables by GriffinP

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.