Screen Control in WinXP and Linux

peter peter.mosley at
Wed Apr 18 00:06:38 CEST 2007

I've been wrestling on and off with this problem for over a year now,
without success.  Basically, I am looking for a simple set of screen
and keyboard manipulation commands that will run identically under
Linux and Windows.  Nothing fancy - just clear the screen, print a
string at an arbitrary xy position and detect a keystroke.  I've
googled around this newsgroup and elsewhere, and come across various
suggestions (and even posted my own partial solutions), but still
haven't come up with an elegant solution.

My latest attempt is a throw back to the 1980's, using ANSI control
codes.  Seems to work on Linux, but not under Windows XP.  I've found
references to an application called (didn't work), and
instructions to modify the config.nt file to include


then run  I thought I was there - I could echo control
codes satisfactorily, then when I tried to run python got an error
message 'This program cannot be run in DOS mode'.

Why is something which is apparently so simple such a hurdle?  Other
cross platform languages (euphoria, yabasic) seem to manage it.   I
don't have the expertise to write the code myself, but surely for the
gurus this is not difficult.

Any ideas?  How can I run ansi.sys in WindowsXP.  Can anyone come up
with module with locate(), cls() and getch() functions? Is there any
point in searching further?

I realise this may come across as a bit petulant - not intended, but I
am genuinely perplexed as to why this is such a show stopper.


More information about the Python-list mailing list