Python Typewriter Code

Video

In this tutorial we show you how you can add animated typewriter style code to your Python console projects to make them look cool ๐Ÿ™‚

 

 

Example Code

Example Code

import sys,time

message = "please enter your name: "

def typewriter(message):
    for char in message:
        sys.stdout.write(char)
        sys.stdout.flush()
        
        if char !=  "\n":
            time.sleep(0.1)
        else:
            time.sleep(1)


def type_input(message):
    for char in message:
        sys.stdout.write(char)
        sys.stdout.flush()
        time.sleep(0.1)
    return input()
        
name = type_input(message)

typewriter("nice to meet you " + name)