Editor

Draw a Kite in Python Turtle

Beginner · Things to draw · 92 lines · draws in about 11 seconds

This program flies a diamond kite made of four coloured triangles, with a wavy tail of bows and a long string across a sky with clouds and a sun.

Draw a Kite in Python Turtle: the finished drawing
import turtle
screen = turtle.Screen()
screen.title("Kite")
screen.bgcolor("skyblue")
t = turtle.Turtle()
t.speed(6)
# Where the two sticks of the kite cross, and the four corners round it
CENTRE = (40, 95)
TOP = (40, 200)
RIGHT = (135, 95)
BOTTOM = (40, -75)
LEFT = (-55, 95)
def triangle(a, b, c, color):
"""A filled triangle through three points."""
t.penup()
t.goto(a)
t.pendown()
t.color(color)
t.begin_fill()
t.goto(b)
t.goto(c)
t.goto(a)
t.end_fill()
def cloud(x, y):
"""A cloud made of four white dots that overlap."""
t.penup()
for dx, dy, size in [(-40, 0, 60), (0, 12, 80), (40, 0, 60), (0, -12, 60)]:
t.goto(x + dx, y + dy)
t.dot(size, "white")
def bow(x, y, color):
"""A small bow on the tail at (x, y): two triangles point to point."""
triangle((x, y), (x - 15, y + 9), (x - 15, y - 9), color)
triangle((x, y), (x + 15, y + 9), (x + 15, y - 9), color)
# The sun and a few clouds
t.penup()
t.goto(-230, 160)
t.dot(90, "gold")
cloud(-150, 100)
cloud(230, 170)
cloud(220, -40)
# The kite: four triangles in two colours
triangle(CENTRE, TOP, RIGHT, "crimson")
triangle(CENTRE, RIGHT, BOTTOM, "gold")
triangle(CENTRE, BOTTOM, LEFT, "crimson")
triangle(CENTRE, LEFT, TOP, "gold")
# The two sticks
t.pensize(3)
t.color("saddlebrown")
t.penup()
t.goto(TOP)
t.pendown()
t.goto(BOTTOM)
t.penup()
t.goto(LEFT)
t.pendown()
t.goto(RIGHT)
# The tail: a wavy line with a bow at every wave
t.pensize(2)
t.penup()
t.goto(BOTTOM)
t.setheading(260)
t.pendown()
for color in ["crimson", "gold", "crimson", "gold"]:
t.color("dimgray")
t.circle(15, 60)
t.circle(-15, 60)
bow(t.xcor(), t.ycor(), color)
# The string, from the middle of the kite down to someone out of sight
t.pensize(1)
t.color("dimgray")
t.penup()
t.goto(CENTRE)
t.pendown()
t.goto(-290, -215)
t.hideturtle()
turtle.done()

How the code works

Corners as named points

Naming the five points makes the drawing code read like a description: a triangle from CENTRE to TOP to RIGHT. Change a number here and every shape that uses that corner moves with it.

CENTRE = (40, 95)
TOP = (40, 200)
RIGHT = (135, 95)
BOTTOM = (40, -75)
LEFT = (-55, 95)

Clouds from dots

A cloud is four white dots that overlap. The list holds how far each dot is from (x, y) and how big it is.

def cloud(x, y):
    """A cloud made of four white dots that overlap."""
    t.penup()
    for dx, dy, size in [(-40, 0, 60), (0, 12, 80), (40, 0, 60), (0, -12, 60)]:
        t.goto(x + dx, y + dy)
        t.dot(size, "white")

Four triangles

Each quarter of the kite is a triangle with one corner at the centre, and the two colours take turns going round.

triangle(CENTRE, TOP, RIGHT, "crimson")
triangle(CENTRE, RIGHT, BOTTOM, "gold")
triangle(CENTRE, BOTTOM, LEFT, "crimson")
triangle(CENTRE, LEFT, TOP, "gold")

A wavy tail with bows

circle(15, 60) curves one way and circle(-15, 60) curves back, which makes one wave. A bow goes where each wave ends, at the turtle's own position from xcor() and ycor().

for color in ["crimson", "gold", "crimson", "gold"]:
    t.color("dimgray")
    t.circle(15, 60)
    t.circle(-15, 60)
    bow(t.xcor(), t.ycor(), color)

Make it yours

Change the code above and press Run. Some ideas:

  • Add 20 to the y value of all five corner points to fly the kite higher.
  • Change "crimson" to "royalblue" in two of the triangle() calls for a blue and gold kite.
  • Change t.goto(-290, -215) to t.goto(290, -215) so the string runs down to the right.

What it uses

Every turtle command the site supports is listed on Python turtle online.