Я создаю текстовую игру, и для ускорения прошлого диалога я хочу, чтобы пользователь мог нажать «Пробел» и пропустить его.
import time
import sys
text_speed = .05
def slow_type(line, speed): #You input the dialogue and speed(smaller = faster)
for l in line:
sys.stdout.write(l)
sys.stdout.flush()
time.sleep(speed)
time.sleep(.5)
if <'Space'> pressed:
text_speed = 0
NL1 = "Huh, I see you finally came. "
slow_type(NL1, text_speed)