Libs worth playing with: Curses

castlevania

vim and xserver, what happened?

In the early days of BSD Unix, there was a game called ‘rogue’ and it utilized some very interesting screen handling on terminals.  A few layers of abstraction later, this grew into what we now call “CURSES.”  Essentially, CURSES is an application programming interface that allows geometric location of text and lines to be passed to a terminal or terminal emulator.  In more anecdotal words, it’s the simplest of ways to make menus and windows and put them where you want them.

I’d list CURSES/NCURSES programs, but…well, there are literally thousands of them still in use.  w3m, GNU screen, tmux, midnight commander, most text editors for terminal, etc.  I’ve used some variant of the CURSES interface to write many little handler programs for which I felt that a TUI was the best possible solution, including a silly Monty Python based project written in PyCURSES, that just so happened to be a fun implementation of of a rogue-like.  It was a total blast to work on, and despite being horribly easy to beat, was a good exercise for experiencing the capacities of OOP that can be used in python in an enjoyable manner.

class EvilKillerRabbit:

Whatever comes next has to be awesome!

All of this is really just a minor bit of backstory that leads to me saying that if you haven’t yet tried it out, curses can often provide some useful utility for making your program easier to deal with while maintaining really good cross-system compatibility.  Where do you start?  Well, here’s a few of the places that I grabbed my earlier info from:

Writing Programs in CURSES

NCURSES Programming HOW_TO

…and those should lead to all kinds of new information that will organicially expand your personal understanding of what may still be one of my favorite standards for graphics in your programming.