Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: full screen UI in perl

by toma (Vicar)
on Jun 12, 2001 at 12:49 UTC ( [id://87751]=note: print w/replies, xml ) Need Help??


in reply to full screen UI in perl

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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://87751]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (7)
As of 2024-04-24 10:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found