Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

print output to screen in table that updates?

by kdmurphy001 (Sexton)
on Nov 08, 2012 at 19:57 UTC ( #1002971=perlquestion: print w/ replies, xml ) Need Help??
kdmurphy001 has asked for the wisdom of the Perl Monks concerning the following question:

Found the Text:Table module on CPAN but it's not doing what I want. Not sure if it's me or if I need to go another direction.

What I would like to see happen is something like this (this scenario is hypothetical but illustrates what I am trying to do) - I have 3 databases (1,2,3). In each database are 3 cities (a,b,c) and each city has 3 people (joe, jill, and larry).

I'd like the output (sent to the screen) to display something like this on the screen. Database: 1 City: A Person: Joe As it progresses through the data when it finishes on Joe and switches to Jill I'd like the Person field\area to update to Jill on the screen. Once it runs through all of the Persons (updating what's dispalyed anytime it's processing on a different person) it would then switch to City B - and update the output on the screen accordingly. I don't want it to spit out a whole new table (what I'm running into with Text::Table) just update it in a manner. Hope that makes sense and Thanks again Monks!

Comment on print output to screen in table that updates?
Re: print output to screen in table that updates?
by Anonymous Monk on Nov 09, 2012 at 04:54 UTC
Re: print output to screen in table that updates?
by zentara (Archbishop) on Nov 09, 2012 at 11:36 UTC
    Are you stuck on Text::Table and console mode? It seems that an event-based gui might be useful too. Like Tk or Gtk2 or Wx.

    With a GUI you could make a nice Table display, and upgrade progress thru the Table. Here is a simple example to show you what it might look like.

    #!/usr/bin/perl use strict; use warnings; use Tk; use Tk::TableMatrix; my $top = MainWindow->new; my $stuff = {}; my $tg = $top->Scrolled( 'TableMatrix', -rows => 21, -cols => 11, -width => 10, -height => 20, -titlerows => 1, -titlecols => 1, -variable => $stuff, -selectmode => 'extended', -resizeborders => 'both', -titlerows => 1, -titlecols => 1, -bg => 'white', )->pack( -expand => 1, -fill=>'both' ); $tg->tagConfigure('active', -bg => 'gray90', -relief => 'sunken') + ; $tg->tagConfigure('title', -bg => 'gray85', -fg => 'black', -relief => + 'sunken') ; $top->Button( -text=>'modify', -command=> sub { $stuff->{'3,3'} = 'asfasf'; #&TMRefresh($tg); $tg->configure(-padx =>( $tg->cget(-padx))); }, )->pack; Tk::MainLoop; sub TMRefresh { #Required input TableMatrix object. #use to force matrix to update, a code trick return if (!$_[0]); $_[0]->configure(-padx =>($_[0]->cget(-padx))); } ###################################################################### +###

    I'm not really a human, but I play one on earth.
    Old Perl Programmer Haiku ................... flash japh
Re: print output to screen in table that updates?
by thargas (Deacon) on Nov 09, 2012 at 13:14 UTC
    Maybe Smart::Comments? It's not a table, but it does "update automatically".
Re: print output to screen in table that updates?
by space_monk (Chaplain) on Nov 09, 2012 at 13:53 UTC
    Perhaps you should send your output to a browser window, where you can add and remove stuff through the wonders of AJAX and dynamic HTML...
    A Monk aims to give answers to those who have none, and to learn from those who know more.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1002971]
Front-paged by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (13)
As of 2014-12-18 08:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (44 votes), past polls