Python’s Turtle

Here’s a thing most people are surprised by when they first find it: Python has a built-in turtle graphics module that can spawn its own Tk graphics window and draw stuff. Minimal example:

    from turtle import Turtle

    t = Turtle()
    for step in range(36):
        t.forward(400)
        t.right(170)

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.