You are not logged in.

#1 2008-10-25 08:34:19

Boris Bolgradov
Member
From: Bulgaria
Registered: 2008-07-27
Posts: 185

[python] Typing effect?

I want to add a 'typing effect' to my program. smile You know... a cursor blinking, printing letters one by one... I want it to look like the program is typing. roll
Like it's shown on this .gif, but in english, of course. tongue

Anyways, is there a simple way of achieving this? I'm trying not to mess with curses, because it always screws the terminal leaving me no choice but to close it. big_smile (I got to read the curses docs one day...)

Last edited by Boris Bolgradov (2008-10-25 11:02:18)

Offline

#2 2008-10-25 11:55:48

Boris Bolgradov
Member
From: Bulgaria
Registered: 2008-07-27
Posts: 185

Re: [python] Typing effect?

Anyone?

Offline

#3 2008-10-25 12:37:20

briest
Member
From: Katowice, PL
Registered: 2006-05-04
Posts: 468

Re: [python] Typing effect?

for a in 'ububuu':
   sys.stdout.write(a)
   sys.stdout.flush()
   time.sleep(1)

(why does damned python insist on putting newline (or space, with trailing ,) after strings?)

Offline

#4 2008-10-25 12:46:35

Boris Bolgradov
Member
From: Bulgaria
Registered: 2008-07-27
Posts: 185

Re: [python] Typing effect?

Thanks! wink

Last edited by Boris Bolgradov (2008-10-25 12:47:24)

Offline

#5 2008-10-25 14:40:07

vkumar
Member
Registered: 2008-10-06
Posts: 166

Re: [python] Typing effect?

(why does damned python insist on putting newline (or space, with trailing ,) after strings?)

You'll be glad when py3k is the de facto release then, because you may decide to remove the newline/space within the print - function. Yep, it's a function now.


div curl F = 0

Offline

Board footer

Powered by FluxBB