Curses has quite a few functions, some of which you may find useful. The addstr();refresh() functions do what you want.

There are also more full-featured curses functions in Curses::Forms and Curses::Widgets.

Here is a snippet that uses Curses to do something like what you want. The hard part is figuring out how to keep the screen refreshed while your code is off doing something more interesting.

use strict; use Curses; my $mwh = new Curses; $mwh->addstr(8, $LINES-2, 'Initialized...'); $mwh->refresh; sleep 2; for (qw(Show_me_first I'm_second Third_then_quit)) { $mwh->addstr(8, $LINES-2, sprintf("%15s",$_)); $mwh->refresh(); sleep 2; } END { endwin(); # Make Curses clean up after itself }

The Perl Curses module documentation assumes that you already understand the curses library. For simple tasks, it's not too bad to figure out. As your requirements become more complex, it is easy to get bogged down in the details of curses. Another approach would be to use a GUI status window such as one provided by Tk (warning: Tk link returns lots of stuff).

It should work perfectly the first time! - toma


In reply to Re: full screen UI in perl by toma
in thread full screen UI in perl by Anonymous Monk

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.