Draw a Flower in Python Turtle: 6 Flower Programs with Code

To draw a flower with Python Turtle, draw one petal with two arcs (circle(radius, angle) twice, turning 180 - angle after each), then repeat it in a loop, turning 360 / petals degrees between petals. This page explains that petal trick with a diagram and then gives six complete flower programs to copy: a simple flower, a colourful one, a sunflower, a layered rose-style flower, a flower with a stem and leaves, and a garden of random flowers.

Every program was run with Python 3.12.5 (Tk 8.6.13) on Windows 11; each screenshot is the real window the code opens. Turtle is built into Python, so there is nothing to install. For the full reference, see the turtle module documentation.

Simple flower code (copy and run)

import turtle

screen = turtle.Screen()
screen.setup(520, 520)
screen.bgcolor("white")

t = turtle.Turtle()
t.speed(0)
t.color("deeppink", "pink")

def petal(radius, angle):
    for _ in range(2):          # two arcs make one petal
        t.circle(radius, angle)
        t.left(180 - angle)

for _ in range(8):              # 8 petals, evenly spaced
    t.begin_fill()
    petal(120, 60)
    t.end_fill()
    t.left(360 / 8)

t.dot(40, "gold")               # the centre
t.hideturtle()
turtle.done()
Simple flower Python Turtle code output: eight pink petals with a gold centre
Eight filled petals and a gold centre.

How the petal works

A petal is two arcs of the same circle. The turtle draws an arc, turns around at the tip, and draws the same arc back to where it started. After two arcs and two turns it has turned a full 360°, so it faces the way it started and the next petal lines up:

def petal(radius, angle):
    for _ in range(2):
        t.circle(radius, angle)   # an arc: part of a circle
        t.left(180 - angle)       # turn around at the tip
Python Turtle flower petal explained: two arcs of a circle drawn with circle(radius, angle), turning left 180 minus angle at the tip
Arc 1 (blue) and arc 2 (red) form one petal.
  • angle sets the width: 30° gives thin petals, 60–90° round ones.
  • radius sets the length.
  • Number of petals: turn 360 / petals between them so they’re evenly spaced.

Colourful flower

Change the fill colour for every petal and let the petals overlap. 24 petals with a 70° arc on a black background:

import turtle

screen = turtle.Screen()
screen.setup(560, 560)
screen.bgcolor("black")

t = turtle.Turtle()
t.speed(0)
t.pensize(2)

colors = ["red", "orange", "yellow", "lime", "cyan", "blue", "purple", "magenta"]

def petal(radius, angle):
    for _ in range(2):
        t.circle(radius, angle)
        t.left(180 - angle)

for i in range(24):                     # 24 overlapping petals
    t.color("white", colors[i % len(colors)])
    t.begin_fill()
    petal(150, 70)
    t.end_fill()
    t.left(360 / 24)

t.dot(50, "white")
t.hideturtle()
turtle.done()
Colorful flower in Python Turtle: 24 overlapping petals in rainbow colours on a black background
24 overlapping rainbow petals.

Sunflower

The seeds use the golden angle (about 137.5°): each seed is placed 137.5° round from the previous one, a little further out. That’s the same spiral pattern real sunflowers grow. screen.tracer(0) draws the 420 seeds instantly:

import math
import turtle

screen = turtle.Screen()
screen.setup(600, 600)
screen.bgcolor("skyblue")
screen.tracer(0)                        # draw instantly

t = turtle.Turtle()
t.hideturtle()

def petal(radius, angle):
    for _ in range(2):
        t.circle(radius, angle)
        t.left(180 - angle)

# petals: a ring starting at the edge of the seed head
t.color("darkorange", "gold")
for i in range(28):
    t.penup()
    t.goto(0, 0)
    t.setheading(i * 360 / 28)
    t.forward(95)
    t.pendown()
    t.begin_fill()
    petal(160, 50)
    t.end_fill()

# seeds: each one 137.5 degrees round from the last (the golden angle)
t.penup()
for n in range(420):
    angle = n * 137.508
    r = 4.5 * math.sqrt(n)
    t.goto(r * math.cos(math.radians(angle)), r * math.sin(math.radians(angle)))
    t.dot(7, "saddlebrown" if n % 2 else "sienna")

screen.update()
turtle.done()
Sunflower in Python Turtle: golden petals around a brown seed head arranged in golden-angle spirals
Petals around a golden-angle seed spiral.

Layered flower (dahlia / rose style)

Stack layers of petals: each layer is smaller, darker and turned a little, which gives the swirl. colormode(255) lets you compute the shades:

import turtle

screen = turtle.Screen()
screen.setup(560, 560)
screen.bgcolor("white")
screen.colormode(255)
screen.tracer(0)

t = turtle.Turtle()
t.hideturtle()

def petal(radius, angle):
    for _ in range(2):
        t.circle(radius, angle)
        t.left(180 - angle)

# layers of petals, each smaller, darker and turned a little
for layer in range(7):
    size = 200 - layer * 26
    shade = (220 - layer * 22, 20 + layer * 4, 60 + layer * 6)
    t.color((120, 0, 30), shade)
    for i in range(5):
        t.penup()
        t.goto(0, 0)
        t.setheading(i * 72 + layer * 23)
        t.pendown()
        t.begin_fill()
        petal(size, 60)
        t.end_fill()

screen.update()
turtle.done()
Layered flower in Python Turtle, dahlia or rose style: seven layers of red petals getting smaller and darker towards the centre
Seven layers of petals.

Flower with a stem and leaves

A leaf is just a green petal, so the same function draws the leaves. The stem is a thick, slightly curved circle() arc:

import turtle

screen = turtle.Screen()
screen.setup(520, 640)
screen.bgcolor("honeydew")

t = turtle.Turtle()
t.speed(0)

def petal(radius, angle):
    for _ in range(2):
        t.circle(radius, angle)
        t.left(180 - angle)

def jump(x, y, heading=0):
    t.penup()
    t.goto(x, y)
    t.setheading(heading)
    t.pendown()

# stem: three pieces of one gentle curve; remember where leaves and head go
t.pensize(8)
t.color("forestgreen")
jump(0, -280, 90)
t.circle(1500, 5)
leaf_right = t.pos()
t.circle(1500, 4)
leaf_left = t.pos()
t.circle(1500, 5)
head = t.pos()

# two leaves: a leaf is just a green petal
t.pensize(1)
t.color("darkgreen", "limegreen")
for (x, y), heading in [(leaf_right, 0), (leaf_left, 110)]:
    jump(x, y, heading)
    t.begin_fill()
    petal(110, 70)
    t.end_fill()

# flower head at the top of the stem
t.color("crimson", "tomato")
for i in range(6):
    jump(head[0], head[1], i * 60)
    t.begin_fill()
    petal(110, 60)
    t.end_fill()
jump(head[0], head[1])
t.dot(45, "gold")
t.hideturtle()
turtle.done()
Python Turtle flower with stem and leaves: red flower head with a gold centre on a curved green stem with two leaves
One petal function for the flower and the leaves.

A garden of random flowers (reusable function)

Wrap the flower in a function with parameters for position, size, petal count and colour, then call it in a loop. random.seed() makes the “random” garden the same every time (remove it for a new garden on each run). More colour ideas in Python Turtle colors:

import random
import turtle

screen = turtle.Screen()
screen.setup(760, 520)
screen.bgcolor("lightgreen")
screen.tracer(0)

t = turtle.Turtle()
t.hideturtle()

def petal(radius, angle):
    for _ in range(2):
        t.circle(radius, angle)
        t.left(180 - angle)

def draw_flower(x, y, size=60, petals=8, color="pink", centre="gold"):
    """A reusable flower: position, size, number of petals and colours."""
    t.color("white", color)
    for i in range(petals):
        t.penup()
        t.goto(x, y)
        t.setheading(i * 360 / petals)
        t.pendown()
        t.begin_fill()
        petal(size, 60)
        t.end_fill()
    t.penup()
    t.goto(x, y)
    t.dot(size / 3, centre)

random.seed(4)                           # the same garden every run
colors = ["hotpink", "orchid", "tomato", "gold", "deepskyblue", "orange", "violet"]
for row in range(3):                     # a 5 x 3 grid, each flower nudged randomly
    for col in range(5):
        x = -290 + col * 145 + random.randint(-35, 35)
        y = 150 - row * 150 + random.randint(-30, 30)
        draw_flower(x, y,
                    size=random.randint(35, 65), petals=random.choice([5, 6, 8, 10, 12]),
                    color=random.choice(colors))

screen.update()
turtle.done()
Random flowers garden in Python Turtle: fifteen flowers of different sizes, colours and petal counts on a green background
15 flowers from one draw_flower() function.

Tips

  • Watch it draw: remove screen.tracer(0) and use t.speed(3) to see each petal appear.
  • Draw instantly: screen.tracer(0) at the start and screen.update() at the end.
  • Petals don’t close? Both turns must be 180 - angle and both arcs the same circle(radius, angle).
  • Window closes immediately: end the program with turtle.done().
  • Save the picture: see getcanvas().postscript() in the Turtle cheat sheet, or take a screenshot.

Frequently asked questions

How do you draw a flower in Python Turtle?

Write a petal() function that draws two arcs with circle(radius, angle) and turns 180 - angle after each, then call it in a loop, turning 360 / petals degrees between petals.

How do I colour the petals?

Set t.color(outline, fill) and wrap each petal in t.begin_fill() / t.end_fill(). Change the fill colour inside the loop for a multicoloured flower.

How do I make the flower draw faster?

Use t.speed(0), or screen.tracer(0) before drawing and screen.update() after it for an instant result.

How do I draw a sunflower in Python?

Draw a ring of yellow petals, then place seed dots at angle n * 137.508 degrees and distance proportional to sqrt(n), the golden-angle spiral shown above.

Do I need to install Turtle?

No. Turtle is part of Python’s standard library; import turtle works in any normal Python installation on Windows, macOS and Linux.

More Turtle drawings to try: