Typing letters slowly using sys
Mitya Sirenef
msirenef at lightbird.net
Fri Apr 5 10:52:07 EDT 2013
On 04/05/2013 10:04 AM, mattgraves7 at gmail.com wrote:
> I am using sys to give the effect that I am typing letters slowly. Basically what I want to have happen is have it show "Loading......" with the word loading appearing instantly and then the periods appearing slowly, as most loading screens do.
> This is what I have.
>
> dots = ('............')
> for x in dots:
> sys.stdout.write(x)
> sys.stdout.flush()
> time.sleep(0.2)
>
> I cannot for the life of me figure out how to get the dots to appear on the same line as "Loading". Every way that I have attempted, the word "Loading" appears and then the dots appear on the next line.
If you're printing in 2.x, you can do:
print "Loading",
in 3.x,
print("Loading", end='')
-m
--
Lark's Tongue Guide to Python: http://lightbird.net/larks/
More information about the Python-list
mailing list