473,407 Members | 2,314 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,407 software developers and data experts.

clear screen / locate cursor

I am just trying to learn python, to use for some fairly basic command
line utilities which will run in either Windows/DOS or Linux. I cannot
find a platform neutral way of manipulating the screen. I don't want
to do anything complex, but just:-

1. Clear the screen
2. Print a string at an arbitrary x,y position
3. Receive a single key stroke

It seems that under Linux the curses module will do all this and more
(though I haven't tried it), but despite Python documentation curses
does not seem to be available under DOS. I have solved the 'clear
screen' problem with the code below, but made no progress on the other
two:-

def cls():
a=os.name
if a=='posix': #linux
os.system('clear')
elif a=='nt': #windows
os.system('cls')
else: #unknown
print
print ('='*(78-len(a)))+a
print

Is this the best solution? Can anyone help with the others? I have
tried searching python documentation and this newsgroup, but found no
pointers. It can't be difficult (for the experts!) - other cross
platform languages such as Yabasic and Euphoria seem to have such a
facility, so what am I missing?

The email address above was genuine once but has long been abandoned
to spam. Pleae reply via newsgroup or to

peter dot mosley at spamguardnorth dot org after removing spamguard

Thanks in advance for any help.
Jul 18 '05 #1
0 2765

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

Similar topics

3
by: Douglas F. | last post by:
Is there a way to locate the mouse cursor in a form's text type (edit box)?
4
by: NeoPhreak | last post by:
How would you clearn the screen in a console program??? Thanks NeoPhreak >.<
19
by: Dave | last post by:
Hi, I have done some research, trying to Clear The Screen in java code. The first option was the obv: system.out.print("\n\n\n\n\n\n\n\n\n\n\n\n"); then i heard about this method:...
8
by: gregory_may | last post by:
Is there a way to grab a "Screen Shot" that includes "Tool Tips"? I saw this code someplace, cant remember where. But it doesnt grab "Tool Tips". Is there a better way to do this in .net?...
3
by: bob | last post by:
Is there anyway to show the hourglass (busy) cursor on the entire monitor screen, not just when the cursor is within the current program's window? Thanks
11
by: Rajendran | last post by:
I just want to clear the above three lines from the current position, so that I can start printing my results from that point. In short I want to clear a portion of my screen. Note: I work in...
2
by: nickyeng | last post by:
i have a function that clear the screen and then display array to cout. i compiled no error no warning, i run it, the screen really get "clear" but it does not display anything to cout, and it...
6
by: Hooyoo | last post by:
I want to get the color of the specified pixel in the screen. Firstly I get the position of the cursor: //Get the position of cursor. Point position = Cursor.Position; Next I want to get the...
4
by: mike | last post by:
I have the opportunity to rescue a project that uses a mouse to sense the relative position of a machine. The hardware is built...just needs to be programmed. Stop snickering!!! I didn't do it...I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.