473,320 Members | 2,161 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Screen Control in WinXP and Linux

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 ansi.com (didn't work), and
instructions to modify the config.nt file to include

dosonly
device=%SystemRoot%\system32\ansi.sys

then run command.com. 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.

Peter

Apr 17 '07 #1
3 1412
En Tue, 17 Apr 2007 19:06:38 -0300, peter <pe**********@talk21.com>
escribió:
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.
What about curses (Linux) and Console (XP)? You could wrap just the bits
needed for your application in a more-or-less generic way.

--
Gabriel Genellina

Apr 17 '07 #2
peter wrote:
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.
OK, a bit of info from the Windows side of
things. Here are several existing modules
which offer the kind of thing you're after
in different ways. Don't bother with the
ANSI thing; it's a dead end under Windows.

http://newcenturycomputers.net/projects/wconio.html
http://effbot.org/zone/console-index.htm
http://adamv.com/dev/python/curses/

I've used the first two for relatively trivial
things, the third not at all. The third is
interesting, obviously, because curses is
readily available on Linux (indeed comes as
part of Python, I think). So that might be
a quick win.

Alternatively, and depending on your needs,
there are a few UI addons for pygame:

http://www.pygame.org/projects/9

Might not be what you're after from your
original description, but better too much
information than too little.

Obviously, unless the curses stuff fits your
needs, you might need to write a wrapper module
doing a bit of conditional importing or
platform-sniffing, but that's not beyond the wit
of man.

TJG
Apr 18 '07 #3
Thanks for these replies. Clearly what I'm looking for does not exist
- yet!

I've started by looking at Frederik Lundh's Console module. It looks
promising, although on basis of ten minutes experience I can't yet
figure out how to use it properly. Perhaps I should study Frederik's
examples ....

Peter

Apr 19 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Miki Tebeka | last post by:
Hello All, I can't connect to our Excahnge server using smtplib from a WinXP box. Connection to the same server from a Linux box works. The code: from smtplib import SMTP s =...
383
by: John Bailo | last post by:
The war of the OSes was won a long time ago. Unix has always been, and will continue to be, the Server OS in the form of Linux. Microsoft struggled mightily to win that battle -- creating a...
10
by: Andy K | last post by:
Hi again , I've been trying to connect to a distant database with my control center on WinXp . I'm using a personnal edition DB2 v8.1.9.700 for the control center on WinXp. I've setup a...
10
by: Marcin Zmyslowski | last post by:
Hello all! I have a database created in MS Access 2003 which works fine in Win2000. This database shows me the following message in WinXP: "The expression On Load you entered as the event...
4
by: Stylus277 | last post by:
Hello, I am working with a client that has an old Linux server with a custom cbase program. The server has been humming along since 1989, with the exception of a HDD fail in 1994, which was...
4
by: TOM | last post by:
I have an application that does not behave too well when the user changes the Display Properties -> Appearance -> FontSize after clicking Display from the Control Panel to "Large Fonts" ...
51
by: someone | last post by:
I was just wondering if there is any way of editing anything already printed on the screen with out using the system("cls") command.
25
by: OziRus | last post by:
Hi, This is my first message on this group. I want to ask something about screen-drawing functions. I wrote and compiled below code succesfully on TC IDE in Win-xp. Then i tried to work it on...
5
by: Aggelos | last post by:
I want to start developing a simple Content Management System and having done that before I know there is a point where you can't manage different versions of applications unless you have a...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.