Making Text look like it's being typed in the Python Shell -
so far method i've come clearing console displaying string 1 more letter. suggestions?
current code:
import os import time in=list(input("text displayed: ")) out="" move=[] print("-") while len(move)<len(in): move+=["/","|","\\","-"] in range(0,len(in)): if in[a]==" ": x=.3 elif in[a] in ",';:!@#$%^&*()_+-=[]{}": x=.25 elif in[a] in "aeiouzxcvbnm1234567890aeiouzxcvbnm": x=.2 else: x=.15 os.system('cls') out+=in[a] print(out+move[a]) time.sleep(x) os.system('cls') print(out) input()
just use print()
end=''
stay on same line, , flush = true
timing:
import time move+=["/","|","\\","-"] text = input('text displayed: ') in text: print(i, end='', flush=true) time.sleep(0.1) print('\n')
this runs as:
bash-3.2$ python3.3 test.py text displayed: test test bash-3.2$
addressing comment, use below code:
import time move=["/","|","\\","-",""] text = input('text displayed: ') in range(len(text)): print(text[i]+move[i%5], end='', flush=true) time.sleep(0.1) print('\n')
Comments
Post a Comment