473,783 Members | 2,564 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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=%SystemR oot%\system32\a nsi.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 1430
En Tue, 17 Apr 2007 19:06:38 -0300, peter <pe**********@t alk21.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
3669
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 = SMTP("our-mail-server") Works fine on Linux but gives the following error in WinXP:
383
12257
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 poor man's DBMS, a broken email server and various other /application/ servers to try and crack the Internet and IS markets. In the case where they didn't spend their own money to get companies to
10
6469
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 node (a distant connection ) in order to reach this distant database but it doesn't seem to work ... The distant database
10
32224
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 property setting produced the following error: A problem occured while Microsoft Access was communicating with the Ole server or ActiveX Control" I also get similiar errors On Load, On Click etc. with the same sentence
4
1881
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 replaced restored from tape. The uptime on this beast is like 12 years and counting. Just this week the last linux terminal was replaced with a new Dell running XP Pro. The client wants to keep the software but wants the space where the server fits...
4
2203
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" or "Extra Large Fonts" (WinXP defaults to "Normal").
51
3948
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
4262
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 dos but it didn't work. It runs but doesn't draw anything on screen. Could you say my fault? I know far,dev and near are a bit problematic in xp but i think compiling with Tc and running in dos might run it? Thanks for everything...
5
1423
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 sollution like version control. I was thinking of having something like one installation for the whole server, but some of you said that this might have security risks. So I've tried to look into SVN which I was told that will do what I like to do.
0
9643
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10315
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10083
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9946
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6737
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5379
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4044
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2877
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.