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

Michael Torrie torriem at gmail.com
Tue Sep 10 20:06:34 EDT 2013


On 09/04/2013 05:41 AM, James Harris wrote:
> 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.

Well it's the same problem you're trying to solve today.  You've got a
text console with a cursor you can move around and print out text.
Besides with any modern operation system you can't write directly to the
screen anyway, like we used to back in the DOS days when we poked
directly into video memory.

> 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.

A toolkit (that's old, arguably), that might help you is TVision, a port
of the old Turbo Vision library that formed the foundation for Borland's
old DOS IDEs back in the day (check wikipedia).  And it looked quite
beautiful back then, actually.  There is a Python binding for it here:

https://pypi.python.org/pypi/PyTVision

The original C++ is here:
http://tvision.sourceforge.net/

TVision does run on DOS, Windows console, and of course Unix, though
you'd need the appropriate shared library.

Or you could write your own, based on top of something like curses.



More information about the Python-list mailing list