Skip main navigation

The Pen extension

The Pen extension adds blocks so that sprites can draw on the stage as they move. Read how you can use these blocks to draw patterns here.

Now that I have introduced you to extensions, you are going to use the Pen extension. This extension provides blocks that allow a sprite to draw on the Stage, and you will use this to draw a spiral and some regular shapes.

Add the Pen extension

  1. Open a new Scratch project
  2. Click on the Extension library button in the bottom left-hand corner

    The Extension library button at the bottom left of the blocks palette, highlighted with a red arrow and rectangle. The extension button has a blue background and shows two white Scratch blocks, and a white plus symbol at the top right of those blocks.

  3. Click on the Pen extension

    The pen extension button on the choose extension menu. The pen extension image is mostly green with a pen image in the centre. There are rainbow coloured lines to the left of the pen giving the impression that the pen has drawn these lines.

The Pen category will then appear at the bottom of the blocks menu.

The Scratch blocks palette, with the Pen category selected at the bottom of the categories menu. All the green pen blocks described below, along with `stamp`, and blocks for changing the pen colour and size are shown in the blocks palette.

Program a pattern

You are going to practice using the Pen extension by combining the: pen up, erase all, set pen colour to () and pen down blocks with other blocks that you have used in this course.

The pen down block will make the sprite leave a pen line on the Stage wherever it moves. When you use the pen up block, it will stop the sprite from drawing a line as it moves around the Stage.

The erase all block removes all the pen marks on the Stage. It is common to use this at the start of a program to erase all the lines from the previous run.

The set pen color to () block sets the colour of the line that the sprite will draw. To change the colour in the set pen color to () block, click on the oval on the block and move the three sliders that appear: Colour, Saturation, and Brightness.

The `set pen colour to ()` block with a menu pointing towards the blue oval that sets the pen colour. On the menu there are three sliders below one another. The top slider sets the colour. The slider below the colour slider sets the saturation, and the slider below the saturation slider sets the brightness.

Now that you have looked at the Pen extension blocks, you are going to use them in a program to create a spiral. As you follow the instructions below, think about the purpose of each block.

  1. Open a new Scratch project
  2. Add the Pen extension if the Pen extension blocks are not already in your Blocks menu
  3. Drag-and-drop the blocks below onto the Code area

    <img src="" alt="Scratch code: when flag clicked, set (steps v) to (0), pen up, hide, erase all, pen up, go to x(0) y(0), set pen color to blue, pen down,repeat until , move (steps) steps, turn cw (15) degrees, change (steps v) by (1)”>

  4. Click the green flag to run the code

The sprite draws a spiral on the Stage and stops when it touches the edge of the Stage.

  1. Change the parameter on the move () steps block
  2. Run your code again to see the impact of your change on the spiral
  3. Change the parameter on the turn right () degrees block
  4. Run your code again to see the impact of your changes on the spiral

Regular shapes

To see what you can achieve by combining the Pen extension and programming concepts from this course to draw regular shapes, investigate this Scratch project, which draws regular shapes . To see the code, make sure you are logged in, and click on the See inside button in the top right of the screen.

This program asks the user “How many sides do you want the shape to have?” The user then types a value as an answer, and the sides variable stores this value. The program then uses a repeat () block to loop around that number of times. On each loop, the sprite will move 50 steps and turn by an angle given by dividing 360 by the value of the sides variable. This value of the angle makes sure that the sprite will draw a full complete shape with no gaps.


You have seen the Pen extension blocks being used in two diffferent projects. Now create a Scratch project of your own that includes the Pen extension, taking inspiration from those projects as well as your own imagination.

  • Share your project on the Scratch website, and paste the share link in the comment section below.
  • Look at the projects shared by your fellow learners, and reply to them with your comments.
This article is from the free online

Introduction to Programming with Scratch

Created by
FutureLearn - Learning For Life

Reach your personal and professional goals

Unlock access to hundreds of expert online courses and degrees from top universities and educators to gain accredited qualifications and professional CV-building certificates.

Join over 18 million learners to launch, switch or build upon your career, all at your own pace, across a wide range of topic areas.

Start Learning now