Text Slider 1.0 (typewriter effect)

With this code you can take any text file and make it go like someone is typewriting it on the console. Watch the video to see how.

import sys
import time
from tkinter import filedialog


def texttime(words):
    "Takes a text and shows it a caracter for 0.07 seconds"
    for c in words:
        sys.stdout.write(c)
        sys.stdout.flush()
        if c != " ":
            time.sleep(0.07)


name = filedialog.askopenfilename()

with open(name, "r", encoding="utf-8") as file:
    file = file.read()


texttime(file)

Published by pythonprogramming

Started with basic on the spectrum, loved javascript in the 90ies and python in the 2000, now I am back with python, still making some javascript stuff when needed.