Created
December 3, 2020 13:37
-
-
Save richardbwest/30e0c29d907923e370ec7df8ca2c3d32 to your computer and use it in GitHub Desktop.
How to do typewriter text with inputs in python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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