[Tutor] What is Curses and why do they call it that.

Alan Gauld alan.gauld at btinternet.com
Tue Oct 13 01:48:16 CEST 2009


"Katt" <the_only_katala at verizon.net> wrote

> Some documentation indicate it as a module that will translate commands 
> to control screen output.  Is this right?  Also, why do they call it 
> curses?

Thats right, it provides a way to draw GUI like "windows" on the screen
using graphics characters if they are available or plain ASCII if not, thus
it offers a degree of terminal independance. It was popular in the period
before GUIs became normal but after they became desirable - ie
around 1985-1995.

A curses screen field will look something like (use monospace font
for this bit)

             +-------------------------+
Name  |                                  |
             +-------------------------+

And you could define the box as a window and position the cursor inside it.
You could then clear the window, read its contents, change its colour,
even resize it etc.  Just like an Edit box in a GUI.

Nowadays most usage is to deliver cursor control to console mode
programs rather than building multi-windowed displays etc.
The default window is the full screen.

See the Event Driven Programming topic of my tutorial for a very simple
demo of curses in use.

The name curses is a pun on the word cursor and the typical reaction
of programmers forced to use curses to build a "GUI"! :-)

HTH,

-- 
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/ 




More information about the Tutor mailing list