Skip to content

Instantly share code, notes, and snippets.

@richardbwest
Created December 3, 2020 13:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save richardbwest/30e0c29d907923e370ec7df8ca2c3d32 to your computer and use it in GitHub Desktop.
Save richardbwest/30e0c29d907923e370ec7df8ca2c3d32 to your computer and use it in GitHub Desktop.
How to do typewriter text with inputs in python
import sys,time
message = "please enter your name: "
def typewriter(message):
for char in message:
sys.stdout.write(char)
sys.stdout.flush()
if char != "\n":
time.sleep(0.1)
else:
time.sleep(1)
def type_input(message):
for char in message:
sys.stdout.write(char)
sys.stdout.flush()
time.sleep(0.1)
return input()
name = type_input(message)
typewriter("nice to meet you " + name)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment