#! /usr/bin/env python3 import time, sys maxIndent = 100 #how many spaces the zigzag should move linewidth = 5 #width of line linechar = '*' indent = 0 indentIncreasing = 1 try: while True: print((' '*indent)+(linechar*linewidth)) #form the string for the current line indent += indentIncreasing if indent > maxIndent or indent <= 0: indentIncreasing *= -1 # change direction time.sleep(0.01) except KeyboardInterrupt: sys.exit()