[Tutor] How to clear the screen

Chris Fuller cfuller084 at thinkingplanet.net
Sun Oct 19 18:16:50 CEST 2008


There are a couple of approaches here.  You could use a screen control library 
like slang or curses (curses is in the standard library), but that is usually 
overkill if you aren't creating a moderately complex interface.  If you just 
want to clear the screen, printing the control sequence ESC[2J is all you 
need.

>>> print chr(0x1b) + '[2J'

http://www.python.org/pyvault/SRPMS/repodata/repoview/python-newt-0-0.52.0-2.html
http://www.wanware.com/tsgdocs/snack.html
http://docs.python.org/library/curses.html
http://www.termsys.demon.co.uk/vtansi.htm

Cheers


More information about the Tutor mailing list