Slowly print out the characters in text one at a time.
(text, pauseAmount=0.1)
| 61 | |
| 62 | |
| 63 | def slowPrint(text, pauseAmount=0.1): |
| 64 | """Slowly print out the characters in text one at a time.""" |
| 65 | for character in text: |
| 66 | # Set flush=True here so the text is immediately printed: |
| 67 | print(character, flush=True, end='') # end='' means no newline. |
| 68 | time.sleep(pauseAmount) # Pause in between each character. |
| 69 | print() # Print a newline. |
| 70 | |
| 71 | |
| 72 | # If this program was run (instead of imported), run the game: |