clearLine = "\x1B\x5B\x32\x4B\x1B\x5B\x47"
clearAll = "\x1B\x5B\x48\x1B\x5B\x32\x4A"
Their variable names say it all, one will clear the line where your cursor is, and the other will clear the entire screen.
Heres a fun little "wait" function im using in one of my scripts...
import sys,time,random
def funPrint(x,f,t=0.1):
left = x
cl = "\x1B\x5B\x32\x4B\x1B\x5B\x47"
while left > 0:
if left-t < 0: t=left
sys.stdout.write(cl+"Wait [ %.1f ] seconds"%left)
sys.stdout.flush()
time.sleep(t)
left -= t
sys.stdout.write(cl+f)
sys.stdout.flush()
for x in range(5):
funPrint(random.uniform(1.3, 3.9), "Checking something...")
time.sleep(1)
print "Were done waiting "
Enjoy
~Cody
Edited by Pyro699, 03 November 2010 - 05:30 AM.