Community resourceWorkspace

1CP2-CT-6.WS4 Compose a scene with subprograms and layers

Part 4 of 6 · 1CP2-CT-6 · Turtle practical lessons

The fourth practical lesson, composing a whole scene from subprograms drawn in a deliberate order.

Students will:

  • decompose a scene into named subprograms
  • use parameters to place and size each object
  • choose a drawing order so layers appear correctly
  • test each subprogram before composing the scene
  • correct a scene whose layers were drawn in the wrong order

A Workspace lesson: students write and run their own Python in the editor. About 60 minutes.

Series: 1CP2-CT-6 · Turtle practical lessons, part 4 of 6.

Shared by Coding PathwayVerified teacher

  • 1 coding activity
  • About 60 minutes
  • CC BY-SA 4.0
  • Shared 17 Aug 2026

Preview

The whole resource, exactly as a class sees it. Answers and marking are held back.

Compose a scene with subprograms and layers

What you will build

You will compose a small park scene from reusable subprograms. The order of the calls will create layers: background first, main objects next and foreground details last.

By the end, you should be able to:

  • decompose a scene into purposeful subprograms;
  • give drawing procedures position, size and colour parameters;
  • move safely between components;
  • control which objects appear behind or in front;
  • test components before integration.

Before you begin

Turtle draws immediately. A filled object drawn later can cover an earlier object. A reliable main program therefore acts like a layer list:

draw_background()
draw_tree(-180, -80, 90)
draw_shelter(20, -100, 160, 110)
draw_sign(170, -110, 55)

The details of each object belong in its procedure. The main program should reveal the overall composition.

Stage 1: use the safe-move helper

Complete move_to(x, y) so it:

  1. lifts the pen;
  2. moves to (x, y) with setposition;
  3. sets heading 0;
  4. lowers the pen.

Test it by moving to two positions. No joining line should appear.

Stage 2: complete one parameterised object

Complete draw_tree(x, y, size).

  • Use move_to(x, y).
  • Draw a trunk using a filled rectangle or repeated straight sides.
  • Reposition above the trunk.
  • Draw the crown using a filled circle or a regular polygon.
  • Base lengths and radius on size so a second call can draw a different-sized tree.

Test the tree procedure by itself at two positions and sizes.

Stage 3: build the layer procedures

Add at least two more purposeful procedures. Suitable choices include:

  • draw_ground();
  • draw_shelter(x, y, width, height);
  • draw_bench(x, y, size);
  • draw_sign(x, y, size);
  • draw_flower(x, y, size, colour).

Each procedure should create one meaningful component, not merely wrap one Turtle command.

Stage 4: compose the main program

Call the procedures in an order that preserves visibility:

  1. large background areas;
  2. objects that should appear behind others;
  3. main objects;
  4. small foreground details.

Run the whole scene. If an object is hidden, decide whether its coordinates or its call order should change.

Success criteria

  • move_to(x, y) prevents joining lines and sets a predictable heading.
  • At least three meaningful drawing procedures are defined.
  • At least one procedure is called more than once with different arguments.
  • Size or colour parameters visibly change an object.
  • Background and foreground calls are in a deliberate order.
  • Each component works alone before the full scene is tested.
  • Names and short comments make the program structure readable.

Debugging prompts

  • Unwanted joining line: inspect move_to and confirm the pen is lifted first.
  • Object appears in the wrong place: test its procedure alone with simple coordinates.
  • Object faces the wrong way: set heading 0 before drawing its boundary.
  • Foreground disappears: move its call later in the main program.
  • Changing size has little effect: find lengths that remain hard-coded instead of using the parameter.

Optional extension

Add a colour parameter to a repeated component and create a coherent palette. Keep every colour string within the supported Turtle colour names.

Evidence to hand in

Your teacher should inspect the layered canvas, the main call order and at least three component procedures. Be ready to show one component test and explain one change made after integration.

Starter code
import turtle

screen = turtle.Screen()
screen.setup(900, 650)

artist = turtle.Turtle()
artist.speed("fast")


def move_to(x, y):
    # Lift the pen, move to the coordinates, face east and lower the pen.
    pass


def draw_tree(x, y, size):
    # Draw a trunk and crown. Base their measurements on size.
    pass


def draw_ground():
    # Draw a background ground area before the main objects.
    pass


# Define at least one more meaningful scene procedure here.


# Main program: call background, objects and foreground details in layer order.


turtle.done()