r/learnpython • • Oct 02 '26

Slow print for text-based game

I am trying to make a text-based adventure game in Python, how do I make it so the text is typed out slowly and not instantly? I've tried ways online, but they keep returning None at the end. How do I fix this?

0 Upvotes

15 comments sorted by

View all comments

2

u/hallmark1984 Oct 02 '26

def write_to_screen(text, char_delay=1)
    for char in text:
        print(char)
        time.sleep(delay)

This would print each letter after a 1s delay, adapt as needed for words, sentences or paragraphs.

2

u/while_True_meme Oct 03 '26

This would print every char on a new line obviously

2

u/hallmark1984 Oct 03 '26

W

H

A

T

D

O

Y

O

U

M

E

A

N