The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Programming Languages
> Python Programming
|
Clear Screen
Discuss Clear Screen in the Python Programming forum on Dev Shed. Clear Screen Python Programming forum discussing coding techniques, tips and tricks, and Zope related information. Python was designed from the ground up to be a completely object-oriented programming language.
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

April 27th, 2004, 08:15 AM
|
|
Contributing User
|
|
Join Date: Apr 2004
Posts: 57
Time spent in forums: 1 h 6 m
Reputation Power: 10
|
|
|
Clear Screen
Hi
How do i clear display screen.
I know they use cls in "C" programme but in python ?
|

April 27th, 2004, 09:00 AM
|
 |
Mini me.
|
|
Join Date: Nov 2003
Location: Cambridge, UK
|
|
Dos box or terminal display?
GUI Tkinter,wxPython,PyQt ......?
Windows or Linux?
Which variant of C uses "cls"?
Help us to help you
Grim 
|

April 27th, 2004, 02:04 PM
|
|
Contributing User
|
|
Join Date: Apr 2004
Posts: 57
Time spent in forums: 1 h 6 m
Reputation Power: 10
|
|
|
clear screen
Sorry it's clrscr()
in (turbo c)
|

April 27th, 2004, 02:27 PM
|
 |
Banned ;)
|
|
Join Date: Nov 2001
Location: Woodland Hills, Los Angeles County, California, USA
|
|
Code:
def clrscr():
for i in range(1, 50):
print
__________________
Up the Irons
What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
"Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
Down with Sharon Osbourne
|

April 27th, 2004, 09:26 PM
|
 |
Hello World :)
|
|
Join Date: Mar 2003
Location: Hull, UK
|
|
Comfused, where did the
Code:
def clrscr():
for i in range(1, 50):
print
come into it  . If you search the forums there were some previous threads about this although i think the genenal idea was to use a system command to clear the console - unless where talking about curses in which case you want to look at the curses module:
http://www.python.org/doc/2.3.3/lib/module-curses.html
EDIT: got ya now, move everything off the screen  . Nice idea heheh. You could also use \b about a million times
Mark.
__________________
programming language development: www.netytan.com – Hula
Last edited by netytan : April 27th, 2004 at 09:29 PM.
|

April 27th, 2004, 09:59 PM
|
 |
Banned ;)
|
|
Join Date: Nov 2001
Location: Woodland Hills, Los Angeles County, California, USA
|
|
Yep, the trouble with using os.system() is that while system() itself is portable, the command you're running isn't necessarily portable. For DOS, it is called "cls" and for *nix, it is called "clear". Who knows what it is going to be on some other OS. Same with the curses module, which only works on *nix terminals.
This clrscr() function might be a bit naive, but I guess it should work on anything that can print. Might need to increase the range of the loop though  .
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|