[Tutor] Clearing the Console Screen

Kent Johnson kent37 at tds.net
Thu Jun 16 17:16:37 CEST 2005


Don Parris wrote:
> With the console-based menu system I'm building, I'd like to clear the
> screen for each menu call - something like:
> 
> def main_menu():
>     clear #start with a fresh console screen, menu at top
>     print menuitems

There is no nice portable way to do this. On Windows running in a DOS window (not in IDLE or another GUI environment) you can use
import os
os.system('cls')

Kent




More information about the Tutor mailing list