Ask coding questions

← Back to all posts
Trailing Letters

In Undertale, there was this set of trailing letters by each character when the dialogue box appeared below and they all made a sound as each letter was iterated.

"Y o u a r e g o n n a h a v e a b a d t i m e ."

For every letter that appeared on-screen, a sound was made and all the letters didn't show up simultaneously; they showed up one-by-one in a chronological time interval.

I was wondering how to do the same for my school project, if there is a way. Currently using Python turtle, but I want to create this in the console.
I'm not sure how to add sound either to my project through Python, or if it's even possible. If not, what programs can add sound for my project?

Tl;dr: I want each letter to appear without me having to time.sleep() through every letter and (if possible) make some sort of sound as it shows up on screen.

Answered by mat1 [earned 5 cycles]
View Answer

You can print letters without creating a new line by doing print(letter, end='', flush=True) and time.sleep(0.1) after that. You current cannot make sounds in the terminal in at the moment. You can suggest that feature to be added in the feedback board.

Please upvote my comment if it was helpful or useful. Thanks! 😀


@themaka Exactly what I needed without the sounds, thank you.


@themaka @mat1 One question, how does the "flush = True" mechanism work in this case?