a portable text user interface ?

J.Jacob joost_jacob at hotmail.com
Fri Feb 8 14:24:37 CET 2002


We would like a -portable- module that provides 4 functions:


setupTextUI(width, height)  # returning a text UI object, top left is
(0,0)

writeXY(textWindow, x, y, string)   # print string on position (x,y)

readXY(textWindow, x, y)    # waiting for user input with cursor
positioned on
                            # (x,y) and returning a string from user
clearWindow(textWindow)


or better function names if you come up with it.

The textWindow parameter is here for the example and not really
necessary
because the module could handle it internally.  The text window's top
left
corner should match the console window's top left.  If the text window
is
bigger than the console window it just gets clipped.  More functions
are not
needed immediately, e.g. you need to erase part of the window just
print
spaces there.

With a module like this included in the Python distribution you could
make
simple text based user interfaces that work on Windows, linux, *nix
and Mac
that dont flicker, that is, if it is well implemented.  It looks so
simple but
it really is not.  You would need to know how to do things on all
platforms.
I tried and gave up, besides i do not have access to much OS's to test
things
with.  Doing this for linux and unix is simple with the curses module,
but
Windows? Mac?  The pdcurses and WConio modules i found for Windows
need
compilation etc., couldnt test/install them properly (no MS compiler
here).
Cygwin Python has partially implemented curses but then you need to
have Cygwin installed.
What we need is something in the Python distribution -itself- that is
portable.
Portable curses would be nice, but maybe its too much to start with,
most
people would be happy with only a few functions like those above,
routines
like the low/high-Video could come later.

We think a well implemented portable text ui module in the Python
distribution would improve Python a lot.  What do other users think? 
What do
the core Python developers think?  Should it be a PEP?



More information about the Python-list mailing list