Python and (n)curses

Jorgen Grahn grahn+nntp at snipabacken.dyndns.org
Tue Jun 19 15:36:59 CEST 2007


On Tue, 19 Jun 2007 02:43:09 -0700, peter <peter.mosley at talk21.com> wrote:
> I've said it before and I'll say it again.  Why does Python have no
> platform neutral commands for simple screen manipulation?  yabasic (a
> 'hobby' type language  - http://www.yabasic.de/) has commands clear
> screen, inkey$ and putscreen$ which perform the basic functions of
> clearing the screen, reading a key press and printing a string at an
> arbitrary xy position in either Windows or Linux, leaving all the
> messy implementation away from the user.

Curses is much more than that, though. One cool feature is its redraw
optimizations -- do a lot of changes, and call a "commit"-type method,
and curses chooses the most optimal (for your terminal) way of changing
the display according to your wishes.

> For me, introducing similar
> commands in Python would be by far the biggest single improvement that
> could be made to the language.

If it should be done, it should be done as a compatible subset of
curses, IMHO. It has such a long history as the standard "GUI toolkit"
for text terminals.

try:
  import curses
except ImportError:
  import inferior_curses as curses

/Jorgen

-- 
  // Jorgen Grahn <grahn@        Ph'nglui mglw'nafh Cthulhu
\X/     snipabacken.dyndns.org>  R'lyeh wgah'nagl fhtagn!



More information about the Python-list mailing list