Facon portable d'effacer une ligne

darcs-hash:20041129143642-d1718-54fb785f2e91b3c7ad9d40f70fc711a3a57a309d.gz
This commit is contained in:
bernat 2004-11-29 15:36:42 +01:00
parent a4fddfc763
commit 3ec9771253

View file

@ -9,6 +9,8 @@ Licence : GPLv2
import sys, sre, os, tempfile
el = os.popen('tput cr ; tput el').read()
def dialog(backtitle,arg) :
""" Affiche la boite de dialogue défine avec les arguments fournis
(cf man dialog)
@ -164,17 +166,17 @@ class anim :
def reinit(self) :
""" Efface la ligne courrante et
affiche : truc................. """
sys.stdout.write('\r' + self.txt)
sys.stdout.write(el + self.txt)
if self.iter :
sys.stdout.write(' '*28)
sys.stdout.write('\r' + self.txt)
sys.stdout.write(el + self.txt)
sys.stdout.flush()
def cycle(self) :
""" Efface la ligne courrante et
affiche : truc..................?
? caratère variant à chaque appel """
sys.stdout.write('\r' + self.txt)
sys.stdout.write(el + self.txt)
if self.iter!=0 :
sys.stdout.write('[')
av = float(self.c) / float(self.iter)