So I used to know how to do this thing where my text would be typed at a speed of 0.1 instead of immediately. But now I have forgotten it. I use to use it in games but those games were deleted. This is most of what is left. The ? is what I forgot.
def textType(text, delay):
for ch in ???
??????????????
print ("")
textType("Hello", 0.1)
HELP ME!

In Python, or a different language? Did it use curses? Was it platform-dependent?
Yes, it was in Python.
And No Curses
So this is what it would have looked like in a game...
#top of code
import time
gold = 0
#This is when it was in.
def textType(text, delay):
for ch in ?????
?????????????
print("")
def start():
textType("Hello", 0.1)
name = input("What is your name?")
#Bla bla bla etc.
Misread your question. I think you want time.sleep(). Was thinking you wanted something people were typing into their terminal echoed back slowly, but you just want to print a whole string you already have more slowly?
OMG!!! YESSS!!! I REMEMBER!! Thank you. That's it
Wait, wait, wait. How would I use
time.sleep(0.1)
with the
def textType
function?
Like if I used it this way:
for ch in text:
print (ch)
time.sleep(0.1)
textType("Hello Everybody!", 0.1)
In function:
time.sleep(delay)
(Oct-31-2016, 10:01 PM)MACA Wrote: [ -> ]Wait, wait, wait. How would I use time.sleep(0.1)
with the def textType
function?
Like if I used it this way:
for ch in text:
print (ch)
time.sleep(0.1)
textType("Hello Everybody!", 0.1)
Hello!
The default behavior of print() functions is to add \n - a new line - character at the end of the printed text. So the next printed text will be printed bellow.
print(ch, end="")
will fix it. The default is
end="\n"