On 8/4/2014 3:24 AM, Wolfgang Maier wrote:
On 08/04/2014 11:53 AM, Glenn Linderman wrote:

I've never used the API from Python but random console access is
documented at
http://msdn.microsoft.com/en-us/library/windows/desktop/ms687404%28v=vs.85%29.aspx


Would using the API from Python involve doing the wrapping yourself or do you know about an existing package for the job ?

I haven't used the API from Python. I haven't checked PyWin32 to see if it already wraps that API like it wraps so many other APIs. I haven't Googled using "python" and "WriteConsoleOutput" to see if other packages may exist to do the job. But these are the things that I would do if I had a need to write a program like yours, since I know that the console does, in fact, support random access.


By the way (and off-topic), how would you do it on Linux?

Off topic? It is still about doing it using Python, no?

I believe that most Unix terminal emulators, which are used for running shells and command lines, support cursor controls, and I believe most of them have a mode that emulates the DEC VT-52 terminal, one of which I had physical access to at the "computer lab" at the university I attended so many years ago. The VT-52 defined escape sequences to move the cursor around on the screen, providing random access. Text-based, screen-oriented programs such as emacs leveraged such capabilities quite effectively.

There may be something better today, I haven't used Unix for a dozen years now, and the usage at that time was database development not text-based graphics. I've used Linux only on my web host, and a little experimentation on a local machine I installed it on here, until the machine died, and I didn't do any text-based graphics in either of those circumstances either. So probably college was the last time I used text-based graphics, but that was using RSTS and DECsystem 20 (forget the name of the OS for that machine) on VT-52 terminals. But I've noted with amusement that the VT-52 (and later enhanced models) are still supported by Unix/Linux terminal emulators and X system.

Unix abstracts that cursor motion using "curses" and I believe there are curses implementations for Windows as well, but I've not attempted to use curses from Python on either Unix or Windows.



Wolfgang


-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to