[affich_tools] afficher sur la console prend du temps
Ignore-this: 4d1e9d64b9d4cf83fe4fb9551cdaf9dc On ne rafraîchit la console que lorsque cela est nécessaire darcs-hash:20090418023225-bd074-a82766419051dea48a5d6d55f294b0811bef8d43.gz
This commit is contained in:
parent
6f2b871668
commit
3323a7779d
1 changed files with 7 additions and 8 deletions
|
@ -305,16 +305,15 @@ class anim :
|
|||
""" Efface la ligne courrante et
|
||||
affiche : truc..................?
|
||||
? caratère variant à chaque appel """
|
||||
sys.stdout.write(el + self.txt)
|
||||
if self.iter!=0 :
|
||||
sys.stdout.write('[')
|
||||
av = float(self.c) / float(self.iter)
|
||||
n = int(20 * av)
|
||||
sys.stdout.write('='*n)
|
||||
sys.stdout.write('>')
|
||||
sys.stdout.write(' '*(20 - n))
|
||||
sys.stdout.write('] %3i%%' % int(100 * av) )
|
||||
prog = float(self.c) / float(self.iter)
|
||||
pprog = float(self.c-1) / float(self.iter)
|
||||
n = int(20 * prog)
|
||||
if 100*prog != 100*pprog:
|
||||
msg = "%s[%s>%s] %3i%%" % (self.txt, '='*n, ' '*(20 - n), int (100*prog))
|
||||
sys.stdout.write(el + msg)
|
||||
else :
|
||||
sys.stdout.write(el + self.txt)
|
||||
sys.stdout.write('/-\|'[self.c%4])
|
||||
sys.stdout.flush()
|
||||
self.c += 1
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue