spinning star

Bengt Richter bokr at oz.net
Tue May 27 05:35:11 EDT 2003


On 27 May 2003 00:20:01 -0500, Ian Bicking <ianb at colorstudy.com> wrote:

>On Tue, 2003-05-27 at 00:06, Andrew Thomson wrote:
>> not really mission critical here, but what would approach would one take
>> to create a spinning star!.. ie, -\|/- etc etc..
>
>Writing chr(13) does the trick, like:
>
>
>chars = "/-\\|"
>total = 10000
>for i in range(total):
>    sys.stdout.write(chr(13))
>    sys.stdout.write('%s %i/%i     ' % (chars[i % 4], i, total))
Just curious, why not replace the previous two lines with
     sys.stdout.write('\r%s %i/%i     ' % (chars[i % 4], i, total))

>    sys.stdout.flush()
>    time.sleep(0.1)
>
Is there an ASR-33 in your past, that you would give yourself the (untaken)
opportunity for a programmed delay after the \r? Or do I misremember ;-)

Regards,
Bengt Richter




More information about the Python-list mailing list