Text Animation

Josiah Carlson jcarlson at nospam.uci.edu
Sun Jan 25 07:04:36 CET 2004


Fazer wrote:
> Hello,
> 
> I was wondering if anyone has done any simple text-based animation?
> 
> I mean things such as text-based pre-loaders.  One example would be
> when you use the *nix utility called `wget.` You get that fancy "
> ====> " type of animation as you download a large file.  Or maybe even
> a rotating " | " that I have seen before in some installation
> programs.
> 
> Any ideas how these effects can be achieved?
> 
> Thanks a lot!
> 
> Faizan


Yeah, don't print linefeed ('\n') characters, only print carriage 
returns ('\r').

import time
for i in xrange(75):
     print '*'*i, '\r',
     time.sleep(.1)

  - Josiah



More information about the Python-list mailing list