What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Python’s turtle module lets you draw shapes by moving a cursor and turning it: move while the pen is down to make a line, repeat the same movement-and-turn pattern to make a polygon, and use circle() for circles or arcs. The drawing appears on screen as the program runs, which Python’s documentation describes as giving learners “instant, visible feedback.”
How Turtle draws a shape
A turtle has a position, a heading and a pen. forward(distance) moves it in its current heading and draws while the pen is down. left(angle) and right(angle) change its heading; they do not draw a line by themselves. The distance is interpreted in the turtle’s coordinate system, so avoid assuming it always corresponds to a fixed number of screen pixels.
For a first drawing, create a turtle object and repeat its movement commands:
import turtle
pen = turtle.Turtle()
# Draw a square
for _ in range(4):
pen.forward(100)
pen.right(90)
turtle.done()
Each pass draws one side and turns the turtle to face the next one. turtle.done() keeps the graphics window open after the drawing commands finish.
The Tool Desk
Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →#1 Best Overall
Draw polygons by repeating a side and turn
A regular polygon uses equal sides and the same exterior turn at each corner. For a polygon with n sides, use a turn of 360 / n degrees after each side. For example, an equilateral triangle turns 120 degrees, a square 90 degrees and a regular hexagon 60 degrees.
| Shape | Side-and-turn pattern |
|---|---|
| Triangle | Repeat 3 times: move forward, then turn 120° |
| Square | Repeat 4 times: move forward, then turn 90° |
| Regular pentagon | Repeat 5 times: move forward, then turn 72° |
| Regular hexagon | Repeat 6 times: move forward, then turn 60° |
Here is a regular hexagon drawn with a loop:
import turtle
pen = turtle.Turtle()
sides = 6
length = 80
for _ in range(sides):
pen.forward(length)
pen.right(360 / sides)
turtle.done()
A loop makes the repeated structure visible and easy to change: adjust sides or length instead of editing each command. Writing each movement explicitly can be helpful for a first tiny example because it exposes every step; loops are more practical for polygons and patterns.
Rank #2
Draw circles and arcs
Call circle(radius) to draw a full circle. Pass an extent to draw only part of one: circle(radius, extent). For example, pen.circle(50, 180) draws a half-circle. Turtle approximates circles with a sequence of small polygon steps, rather than rendering a mathematically perfect curve.
Move without drawing, then change the pen
Raise the pen with penup() (alias up()) before moving to a new position without leaving a line. Call pendown() (alias down()) to resume drawing. This lets one program place several separate figures in the same window:
Quick wins for a faster PC:
Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Clear out junk files and repair common Windows errorsFree Scan →Rank #3
import turtle
pen = turtle.Turtle()
# Draw a square
for _ in range(4):
pen.forward(100)
pen.right(90)
# Move to another starting point without drawing
pen.penup()
pen.goto(140, 0)
pen.pendown()
pen.circle(50)
turtle.done()
Set the outline color with color() and line thickness with width() or pensize(). To set both outline and fill colors in one call, use pen.color("red", "gold").
Fill a shape
Start fill tracking immediately before tracing a closed outline and finish it after the last side. For a triangle:
import turtle
pen = turtle.Turtle()
pen.color("red", "gold")
pen.begin_fill()
for _ in range(3):
pen.forward(100)
pen.left(120)
pen.end_fill()
turtle.done()
The line color is red and the interior fill is gold. In Python 3.14 and later, a fill context manager offers another way to mark the drawing block:
with pen.fill():
for _ in range(3):
pen.forward(100)
pen.left(120)
Use begin_fill() and end_fill() if your Python version predates 3.14. For self-intersecting outlines, fill results can depend on the operating system’s graphics implementation.
Windows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallCrashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteBest Value
Choose a coding style that fits the drawing
- Turtle object:
pen = turtle.Turtle()gives commands a clear owner and is easier to extend when a program has multiple turtles. You can also use the functional interface, which is compact for a short demonstration. - Loop or explicit calls: explicit commands show every individual step; a loop expresses the repeated rule and makes it easy to scale a polygon or pattern.
- Fill calls or context manager: the established
begin_fill()/end_fill()pair works across older versions;with pen.fill():is available beginning with Python 3.14.
Prefer import turtle and the explicit turtle. prefix for functions, or create a Turtle() object as above. The Python documentation cautions that from turtle import * imports many names and can create conflicts in larger scripts.
What Turtle is—and is not—suited to
Turtle is a useful way to explore movement, angles, loops and visible program feedback while making simple drawings. It is not a replacement for a general-purpose graphics or image-rendering library when a project needs more extensive rendering capabilities. The turtle cursor’s own shape()—arrow, turtle, circle, square, triangle or the default classic cursor—is separate from the geometric shape traced by movement commands.
Fix a missing Tkinter error
Turtle’s graphics window depends on Tkinter. Python.org’s Windows and macOS installers include it, while some Linux distributions and other platforms package the Tk interface separately. If importing turtle fails with an _tkinter error, check whether your platform’s Tk interface package is installed rather than reinstalling Python without checking.
For version-specific details, see the Python 3.12 turtle documentation and the Python 3.15.0rc3 turtle documentation; the latter is prerelease documentation. Learners who want a structured book can also look at Python for Kids, 2nd Edition, which includes a chapter on Turtle graphics.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




