[Tutor] "Goto"-function

D-Man dsh8290@rit.edu
Fri, 16 Mar 2001 10:44:56 -0500


On Fri, Mar 16, 2001 at 03:05:08PM +0100, J=F6rg W=F6lke wrote:
| > > | > >>>os.system('clear')
| > > this is only for Unix systems.
| > >=20
| > > | os.system('CLS')
| > > and this is only for dos.
| > >=20
| > > For everything, use :
| > > print "\n" * 24
| >=20
| > Nah, that only works for 24 line terminals=20
| > - xterms and VGA DIS screens(43 or 50 lines) won't work.

print "\n" * sys.maxint  <grin>

That may take a while though.  ;-)

| > Clearing the screen is very terminal specific - which is=20
| > why there isn't a standard function for it in Python I guess.
|=20
| Is nobody out there using curses (to get rid of terminal depenency) any=
more?
| curses.clear()

I'm sure that unix people are using curses.  The problem is that M$
doesn't think curses is important, so if you want your app to work on
Windows systems it can't rely on curses.  If the interpreter was built
with cygwin (and it's curses port) then it would work much better.  Of
course the whole purpose of cygwin is to try and provide the good
qualities of Unix on the other platform.  Even Apple now provides Unix
functionality built-in to their system (MacOS X has a *BSD kernel,
also tcsh and utils like telnet).

| > I think /F's terminal(name?) module tries to take care of most of
| > these differences.

I haven't tried his module, but I have heard that he implemented a
subset of ncurses in python to provide such cross-os terminal
independence.

| > Alan G.
| > who appreciates that D probably knows all that... :-)

:-)


Just for fun, I think I'll mention that my .bashrc contains "alias
cls=3Dclear", so the os.system( "cls" ) technique would work for my
login shells (only if it is lowercase though).

-D