Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
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":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (2)
As of 2024-04-25 20:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found