我正在创建一个基于文本的游戏,为了加速过去的对话,我希望用户能够点击'空间'并跳过它。
  
  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)