Python TUI that will work on DOS/Windows and Unix/Linux

James Harris james.harris.1 at gmail.com
Wed Sep 4 07:41:06 EDT 2013


"James Harris" <james.harris.1 at gmail.com> wrote in message 
news:kvmvpg$g96$1 at dont-email.me...
> Am looking for a TUI (textual user interface) mechanism to allow a Python 
> program to create and update a display in text mode. For example, if a 
> command prompt was sized 80x25 it would be made up of 80 x 25 = 2000 
> characters. The Python program would need to be able to write to any of 
> those 2000 characters at any time though in practice the display would 
> normally be arranged by dividing it up into non-overlapping rectangular 
> regions.
>
> I have seen that there are various libraries: urwid, newt, console, dialog 
> etc. But they seem to be either for Unix or for DOS, not for both. I am 
> looking for a library that will run under either.

In case anyone else is following this, people have emailed me directly 
suggesting ncurses, pdcurses and these:

Pygcurse (http://inventwithpython.com/pygcurse/)
UniCurses (http://sourceforge.net/projects/pyunicurses/)

Naturally, all of these are centred on curses. I have been reading up on it 
and must say that the whole curses approach seems rather antiquated. I 
appreciate the suggestions and they may be what I need to do but from what I 
have seen of curses it was designed principally to provide common ways to 
control cursor-based terminals. That was a-la-mode in the days when we had 
terminals with different cursor control strings and I remember programming 
VT100 and VT52 monitors or terminals like them. But now it seems cumbersome.

I haven't thought too much about it so this is not a design proposal but it 
might be better to divide a display up into non-overlapping windows and 
treat each one separately. Writes to one would not be able to affect the 
others. A given window could allow writes to fixed locations or could behave 
as a glass teletype, writing to the bottom of the window and scrolling as 
needed, or could behave as a viewing port into a data structure. Something 
like that may be more useful to a programmer even if it has to use curses 
underneath because that's all that the OS provides.

James





More information about the Python-list mailing list