A Step-by-Step Guide for Beginners
Welcome, students! Today, we're going to create a spooky Jack-o'-Lantern using Turtle graphics. Let's start by setting up our drawing environment.
We'll use the speed() command to control how quickly Tracy the Turtle draws.
speed(0)):speed(0)
Note: At speed(0), Tracy draws instantly without showing the drawing process.
speed(7) or speed(8)):speed(7) # or speed(8)
Recommendation: I encourage you to experiment by switching between speed(0) and speed(7) or speed(8). This will help you observe how the drawing unfolds, making it easier to understand the sequence of commands and Tracy's movements.
Next, we'll change the background color to make our Jack-o'-Lantern stand out.
bgcolor("black")
The pumpkin base is a large filled circle positioned at the center-bottom of the canvas.
First, we'll lift the pen so Tracy doesn't draw while moving to the starting position.
penup()
setposition(0, -125)
pendown()
Now, let's set the color to dark orange and draw a filled circle to represent the pumpkin.
color("dark orange") # Set color to dark orange
begin_fill() # Start filling the shape
circle(150) # Draw a circle with radius 150
end_fill() # End filling the shape
We'll create two white filled triangles to serve as the eyes of our Jack-o'-Lantern.
Lift the Pen and Move to Position:
penup()
setposition(-75, 50) # Move to position for the left eye
pendown()
Set the Color and Draw the Filled Triangle:
color("white") # Set the drawing color to white
begin_fill() # Start filling the shape
forward(50) # Move forward by 50 units
left(120) # Turn left by 120 degrees
forward(50)
left(120)
forward(50)
left(120)
end_fill() # End filling the shape
Lift the Pen and Move to Position:
penup()
setposition(25, 50) # Move to position for the right eye
pendown()
Set the Color and Draw the Filled Triangle:
color("white") # Set the drawing color to white
begin_fill() # Start filling the shape
forward(50) # Move forward by 50 units
left(120) # Turn left by 120 degrees
forward(50)
left(120)
forward(50)
left(120)
end_fill() # End filling the shape
The mouth consists of multiple smaller white filled triangles arranged in a semi-circular pattern.
Lift the Pen and Move to Starting Position:
penup()
setposition(90, -25) # Move to starting position for the mouth
pendown()
Turn Tracy left by 190 degrees to set the starting angle for the mouth.
left(190) # Turn left by 190 degrees
We'll draw six smaller triangles to create the mouth pattern. Repeat the following steps six times:
Draw a Smaller Triangle:
color("white") # Ensure the color is white
begin_fill() # Start filling the shape
forward(30) # Move forward by 30 units
left(120) # Turn left by 120 degrees
forward(30)
left(120)
forward(30)
left(120)
end_fill() # End filling the shape
Move Forward and Adjust Angle:
forward(30) # Move forward by 30 units
right(5) # Turn right by 5 degrees
Draw a Smaller Triangle:
color("white")
begin_fill()
forward(30)
left(120)
forward(30)
left(120)
forward(30)
left(120)
end_fill()
Move Forward and Adjust Angle:
forward(30)
right(5)
Draw a Smaller Triangle:
color("white")
begin_fill()
forward(30)
left(120)
forward(30)
left(120)
forward(30)
left(120)
end_fill()
Move Forward and Adjust Angle:
forward(30)
right(5)
Draw a Smaller Triangle:
color("white")
begin_fill()
forward(30)
left(120)
forward(30)
left(120)
forward(30)
left(120)
end_fill()
Move Forward and Adjust Angle:
forward(30)
right(5)
Draw a Smaller Triangle:
color("white")
begin_fill()
forward(30)
left(120)
forward(30)
left(120)
forward(30)
left(120)
end_fill()
Move Forward and Adjust Angle:
forward(30)
right(5)
Draw a Smaller Triangle:
color("white")
begin_fill()
forward(30)
left(120)
forward(30)
left(120)
forward(30)
left(120)
end_fill()
Move Forward and Adjust Angle:
forward(30)
right(5)
A single smaller white filled triangle represents the nose.
Lift the Pen and Move to Position:
penup()
setposition(15, 20) # Move to position for the nose
pendown()
Turn Tracy left by 20 degrees to align the nose correctly.
left(20) # Turn left by 20 degrees
color("white") # Set the drawing color to white
begin_fill() # Start filling the shape
forward(30) # Move forward by 30 units
left(120) # Turn left by 120 degrees
forward(30)
left(120)
forward(30)
left(120)
end_fill() # End filling the shape
The stem is a green filled rectangle positioned on top of the pumpkin.
Lift the Pen and Move to Position:
penup()
setposition(15, 140) # Move to position for the stem
pendown()
Set the Color to Green:
color("green") # Set color to green
Draw the Rectangle:
begin_fill() # Start filling the shape
forward(30) # Move forward by 30 units
right(90) # Turn right by 90 degrees
forward(60) # Move forward by 60 units
right(90) # Turn right by 90 degrees
forward(30) # Move forward by 30 units
right(90) # Turn right by 90 degrees
forward(60) # Move forward by 60 units
right(90) # Turn right by 90 degrees
end_fill() # End filling the shape
Now, let's put everything together. Below is the complete code to draw the Jack-o'-Lantern without using functions or loops:
speed(0) # Change to speed(7) or speed(8) to see the drawing process
bgcolor("black")
# Draw the Pumpkin Base
penup()
setposition(0, -125)
pendown()
color("dark orange")
begin_fill()
circle(150)
end_fill()
# Draw the Left Eye
penup()
setposition(-75, 50)
pendown()
color("white")
begin_fill()
forward(50)
left(120)
forward(50)
left(120)
forward(50)
left(120)
end_fill()
# Draw the Right Eye
penup()
setposition(25, 50)
pendown()
color("white")
begin_fill()
forward(50)
left(120)
forward(50)
left(120)
forward(50)
left(120)
end_fill()
# Draw the Mouth - Triangle 1
penup()
setposition(90, -25)
pendown()
left(190)
color("white")
begin_fill()
forward(30)
left(120)
forward(30)
left(120)
forward(30)
left(120)
end_fill()
forward(30)
right(5)
# Draw the Mouth - Triangle 2
color("white")
begin_fill()
forward(30)
left(120)
forward(30)
left(120)
forward(30)
left(120)
end_fill()
forward(30)
right(5)
# Draw the Mouth - Triangle 3
color("white")
begin_fill()
forward(30)
left(120)
forward(30)
left(120)
forward(30)
left(120)
end_fill()
forward(30)
right(5)
# Draw the Mouth - Triangle 4
color("white")
begin_fill()
forward(30)
left(120)
forward(30)
left(120)
forward(30)
left(120)
end_fill()
forward(30)
right(5)
# Draw the Mouth - Triangle 5
color("white")
begin_fill()
forward(30)
left(120)
forward(30)
left(120)
forward(30)
left(120)
end_fill()
forward(30)
right(5)
# Draw the Mouth - Triangle 6
color("white")
begin_fill()
forward(30)
left(120)
forward(30)
left(120)
forward(30)
left(120)
end_fill()
forward(30)
right(5)
# Draw the Nose
penup()
setposition(15, 20)
pendown()
left(20)
color("white")
begin_fill()
forward(30)
left(120)
forward(30)
left(120)
forward(30)
left(120)
end_fill()
# Draw the Stem
penup()
setposition(15, 140)
pendown()
color("green")
begin_fill()
forward(30)
right(90)
forward(60)
right(90)
forward(30)
right(90)
forward(60)
right(90)
end_fill()
Tip: To observe the drawing process, change the speed(0) at the beginning of the code to speed(7) or speed(8). This will allow you to see each step as Tracy draws the Jack-o'-Lantern. Once you're comfortable, you can switch back to speed(0) for faster rendering.
Why Change Speeds?
speed(0): Tracy draws instantly, making the final image appear without showing the drawing process.speed(7) or speed(8): Tracy draws quickly but still shows the drawing steps, allowing you to follow along and understand how each part is constructed.How to Experiment:
speed(7) or speed(8) to watch the Turtle as it draws each part of the Jack-o'-Lantern. This visual feedback helps in comprehending the sequence of commands and the Turtle's movements.speed(0) to see the final image appear instantly. This demonstrates how speed settings can affect the visualization of the drawing process.
The left() and right() commands change Tracy's heading direction. Positive values turn Tracy left, and negative values turn Tracy right. Accurate angles (like 120 degrees for equilateral triangles) are crucial for correctly shaped features.
penup() and pendown():
These commands control whether Tracy draws while moving. Use penup() to move without drawing and pendown() to start drawing again. This is essential for positioning Tracy without leaving unwanted lines on the canvas.
The begin_fill() and end_fill() commands allow you to create filled shapes. Ensure that all drawing commands for the shape are between these two commands to achieve a solid fill.
The setposition(x, y) command moves Tracy to a specific coordinate on the canvas, which is crucial for placing different parts of the Jack-o'-Lantern accurately. Understanding the coordinate system helps in designing symmetrical and well-proportioned drawings.
Pay attention to the angles used in left() and right() commands to ensure shapes are drawn correctly. For example, equilateral triangles require turning by 120 degrees, and rectangles require 90-degree turns.
Feel free to experiment further by:
color() commands to use different colors for various parts of the Jack-o'-Lantern.forward() and circle() commands to create larger or smaller pumpkins.