Typing letters slowly using sys

M

mattgraves7

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.
 
J

John Gordon

In said:
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.

How are you printing the "Loading" text? (It would have helped a lot to
show us that code.)
 
G

Grant Edwards

dots = ('............')
for x in dots:
sys.stdout.write(x)
sys.stdout.flush()
time.sleep(0.2)

That works just fine for me using Python 2.4, 2.6, 2.7 and 3.2.
 
M

Mitya Sirenef

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
 
M

Matt

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.

Sorry guys, I may have not been clear. The part I pasted does work, but I cannot figure out how to get that to print after the word "Loading". So it will instantly print "Loading", and then the "..........." will appear slowly
 
J

John Gordon

In said:
Sorry guys, I may have not been clear. The part I pasted does work, but
I cannot figure out how to get that to print after the word "Loading". So
it will instantly print "Loading", and then the "..........." will appear
slowly

Have you tried:

sys.stdout.write('Loading')
sys.stdout.flush()
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top