PDA

View Full Version : Clear in Python



didinium
December 6th, 2011, 01:41 AM
Hello everyone. I'm somewhat new to python and want to create an ASCII animation, how would I do a clear in the code itself to create frames. Thanks in advance, Jonah Lubin.

cgroza
December 6th, 2011, 03:32 AM
You cold print a bunch of lines or you could look into a more advanced library such as ncurses.

didinium
December 6th, 2011, 03:41 AM
Though with an ASCII movie there is already so many lies of code it would be more streamlined if i just used a single line clear command.

DangerOnTheRanger
December 6th, 2011, 06:01 AM
ncurses is probably what you're looking for.

Bodsda
December 6th, 2011, 09:36 AM
or you could use the os module to run the clear command, ncurses is better but this still works



import os
os.system('clear')

didinium
December 6th, 2011, 01:02 PM
Ya I'm kinda new to python so NCurses is a bit out of my reach but the os clear looks good