Typewriter effect on inputs (python) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Typewriter effect on inputs (python)

So I learned how to get python to print strings horizontally over a certain period of time instead of putting out the entire string at once. Like the interface is typing: import sys,time,os message = ("hello world!) for char in message: sys.stdout.write (char) sys.stdout.flush() time.sleep (0.1) What I'm trying to figure out it how to get it to respond to input by using the same method but when I do: import sys,time,os message = input ("hello world!) for char in message: sys.stdout.write (char) sys.stdout.flush() time.sleep (0.1) It just prints everything out at once again. Anyone know how to fix? Thanks!

29th Aug 2019, 5:01 PM
AR0
AR0 - avatar
4 Answers
0
Works if I don't put input. Something about that input is messing it up...
29th Aug 2019, 5:18 PM
AR0
AR0 - avatar
0
Hey! I have the same problem. It looks like when I run it through the text of an input, it wants to return “None” before the user can enter an input. Did you find a solution to this?
23rd Apr 2020, 10:07 PM
Joel
0
Mirielle[Inactive] nice! After I posted this I came to another solution: use whatever you need to for the typewriter effect, then set the input as simply “ “. So the typewriter effect only affects a string, and the imput is just a space occurring between the sentence and the actual input.
24th Apr 2020, 1:19 AM
Joel
0
Sorry bout that lol
16th Nov 2020, 5:12 PM
AR0
AR0 - avatar