Introduction to Programming

Shapes & Pen Extension

Lesson 3: Drawing Shapes

What is the Pen Extension?

PictoBlox has a special set of blocks called the Pen Extension. These blocks allow a sprite to draw on the Stage as it moves — just like holding a pen to paper!

The Pen Extension is not available by default. You need to add it by clicking the Extension button at the bottom left of the Code tab.
Pen extension blocks panel in PictoBlox showing blocks like pen down, pen up, set pen color, set pen size, and erase all
The Pen Extension blocks in PictoBlox

Key Pen Blocks

Pen Extension Blocks

BlockPaletteWhat it Does
Pen DownPenStarts drawing as the sprite moves
Pen UpPenStops drawing
Erase AllPenClears all drawings from the Stage
Set Pen Color to ()PenChanges the color of the pen
Set Pen Size to ()PenChanges the thickness of the pen line
StampPenStamps the sprite's image onto the Stage

Drawing Shapes

By combining Pen blocks with Motion blocks, you can draw shapes on the Stage. The key idea is that a sprite moves in straight lines and turns at angles to form the sides and corners of a shape.

To draw a closed shape, the total turning angle of the sprite must add up to 360°.

Shapes and Their Properties

ShapeNumber of SidesTurning Angle
Triangle3120°
Square490°
Pentagon572°
Hexagon660°
Circle (approx.)360

Activity: Drawing a Square

Let's draw a square using the Pen Extension. A square has 4 equal sides and 4 corners, each turning 90°.

  • Open PictoBlox and create a New File.
  • Add the Pen Extension from the Extensions menu.
  • Place the sprite at the center of the Stage using the 'Go to x: 0 y: 0' block.
  • Add the 'Erase All' block to clear any previous drawings.
  • Add the 'Pen Down' block to start drawing.
  • Use a 'Repeat 4' loop containing 'Move 100 steps' and 'Turn 90 degrees' to draw the square.
  • Add the 'Pen Up' block at the end to stop drawing.
  • Click the green flag to run the script and see your square!
Block coding script in PictoBlox showing when flag clicked, erase all, go to x 0 y 0, pen down, repeat 4 with move 100 steps and turn 90 degrees, then pen up
Script to draw a square using the Pen Extension
A white square drawn on the PictoBlox stage by the sprite using the pen extension
A square drawn on the Stage using the Pen Extension
Try changing the number of sides and the turning angle to draw different shapes like a triangle or hexagon!

Subscribe to our newsletter.

Get updates to news and events.