Python Turtle Size

When I first started working with Python Turtle graphics, controlling the size of both the turtle and its drawings was one of my biggest challenges. Understanding how to properly adjust these elements can make a huge difference in your visual output.

In this article, I’ll share practical techniques to control Python Turtle size, from adjusting the turtle icon itself to scaling the thickness of lines it draws. I’ve compiled these methods from my decade-plus experience working with Python’s graphics capabilities.

So let’s get right in and master the various size controls in Python Turtle!

Understand Turtle Size Parameters

The Python Turtle module gives us several ways to control size:

  1. Turtle icon size (the actual arrow/turtle pointer)
  2. Pen size (thickness of lines drawn)
  3. Screen size (the drawing canvas)

Each of these can be adjusted independently to achieve the exact visual effect you need.

1: Change the Turtle Icon Size

The turtle icon is what you see moving around the screen as it draws. Here’s how to adjust its size:

import turtle

# Create a turtle
t = turtle.Turtle()

# Change the turtle size
t.turtlesize(2, 2, 1)  # Width, length, outline

# Draw something to see the effect
t.forward(100)

You can refer to the screenshot below to see the output.

how to change turtle size in python

The turtlesize() method (also available as shapesize()) takes three parameters:

  • The width stretch factor
  • The length stretch factor
  • The outline width

If you only want to uniformly scale the turtle, you can use:

# Makes the turtle twice its original size
t.turtlesize(2)

This is perfect when creating visual elements where the turtle cursor itself is part of the display.

Read Python Turtle Grid

2: Adjust the Pen Size

The pen size determines how thick the lines are when your turtle draws:

import turtle

t = turtle.Turtle()

# Set a thicker pen
t.pensize(5)  # 5 pixels wide

# Draw a line
t.forward(100)

# Change to a thinner pen
t.pensize(1)
t.forward(100)

You can refer to the screenshot below to see the output.

turtle size python

For creating emphasis in your drawings, try varying the pen size throughout your program:

import turtle

t = turtle.Turtle()

# Draw a square with varying line thickness
for i in range(4):
    t.pensize(i + 1)  # Increase thickness with each side
    t.forward(100)
    t.right(90)

Check out the Python Turtle Pen

3: Get and Set Screen Size

Controlling the canvas size is important for properly displaying your turtle graphics:

import turtle

# Create screen and get its current size
screen = turtle.Screen()
current_width, current_height = screen.window_width(), screen.window_height()
print(f"Default screen size: {current_width}x{current_height}")

# Set a custom screen size
screen.setup(width=800, height=600)

# Create and use a turtle
t = turtle.Turtle()
t.forward(300)

You can refer to the screenshot below to see the output.

python turtle size

The default screen size is typically 800×600 pixels, but Python turtle default screen size can vary depending on your system.

You can also set the screen size using the setup() method with percentages:

# Set the window to 75% of the screen width and 80% of the screen height
screen.setup(width=0.75, height=0.8)

4: Control Drawing Scale with Coordinate System

Another way to control the overall size of your drawings is by adjusting the coordinate system:

import turtle

screen = turtle.Screen()
t = turtle.Turtle()

# Set coordinate system (default is -window_width/2 to window_width/2)
screen.setworldcoordinates(-50, -50, 50, 50)

# Now drawing a line of 100 units will look much larger
t.forward(40)  # This will almost cross the entire screen

Practical Example: Create a Solar System Simulation

Let’s combine these size controls in a practical example, a simple solar system where planet sizes vary:

import turtle
import random

# Setup the screen
screen = turtle.Screen()
screen.bgcolor("black")
screen.title("Solar System")
screen.setup(800, 800)

# Create the sun
sun = turtle.Turtle()
sun.shape("circle")
sun.color("yellow")
sun.turtlesize(5)  # Large sun
sun.penup()

# Create planets with different sizes
planets = []
sizes = [0.5, 0.8, 1, 0.9, 2.5, 2.2, 1.8, 1.6]  # Relative planet sizes
colors = ["gray", "orange", "blue", "red", "brown", "gold", "lightblue", "blue"]

for i in range(8):  # 8 planets
    planet = turtle.Turtle()
    planet.shape("circle")
    planet.color(colors[i])
    planet.turtlesize(sizes[i])
    planet.penup()

    # Position the planet (distance from sun)
    distance = 50 + i * 30
    planet.goto(distance, 0)

    # Draw orbit
    planet.pendown()
    planet.pensize(0.5)  # Thin orbit line
    planet.pencolor("gray")
    planet.circle(distance)
    planet.penup()

    planets.append((planet, distance))

turtle.done()

This example demonstrates:

  • Using turtlesize() to create differently sized planets
  • Using pensize() for thin orbit lines
  • Setting screen size with setup()

Read Python Turtle Input

Advanced Technique: Animated Size Changes

You can create interesting animations by dynamically changing the turtle’s size:

import turtle
import time

screen = turtle.Screen()
screen.bgcolor("black")

t = turtle.Turtle()
t.shape("circle")
t.color("red")
t.penup()

# Pulse animation
for _ in range(5):  # Pulse 5 times
    # Grow
    for size in range(1, 10):
        t.turtlesize(size)
        screen.update()  # Update the screen
        time.sleep(0.05)

    # Shrink
    for size in range(10, 1, -1):
        t.turtlesize(size)
        screen.update()
        time.sleep(0.05)

turtle.done()

To make this animation smoother, you can use tracer:

screen.tracer(0)  # Turn off automatic updates
# ... animation code ...
screen.update()  # Manually update when needed

Troubleshoot Common Size Issues

Now, I will explain to you how to troubleshoot common size issues.

Check out Python Turtle Draw Letters

Problem: Turtle Drawing Exceeds Screen Boundaries

If your turtle drawing is too large for the screen, you have several options:

  1. Increase the screen size:
screen.setup(1000, 1000)
  1. Scale down your drawing by using smaller distances:
t.forward(50)  # Instead of t.forward(100)
  1. Adjust the world coordinates:
screen.setworldcoordinates(-200, -200, 200, 200)

Read Python Turtle Mouse

Problem: Turtle Icon Is Too Small or Too Large

If the turtle icon size doesn’t look right:

# For a smaller turtle
t.turtlesize(0.5)

# For a larger turtle
t.turtlesize(3)

# You can also hide the turtle completely if it's in the way
t.hideturtle()

Python’s hideturtle() method is especially useful when creating final presentations of your artwork.

When to Use Different Size Controls

  • Use turtle size (turtlesize()) when the turtle itself is part of your visual design
  • Use pen size (pensize()) to control line thickness for emphasis or detail
  • Use screen size control to ensure your drawing fits appropriately on different displays
  • Use coordinate system adjustments for precise scaling of complex drawings

With these controls at your fingertips, you can create everything from simple diagrams to complex animations with the perfect proportions.

I hope you found this guide helpful for mastering size controls in Python Turtle. Experiment with these techniques in your projects, and you’ll gain an intuitive feel for which size adjustments to use for different effects.

You may read other Turtle-related articles:

51 Python Programs

51 PYTHON PROGRAMS PDF FREE

Download a FREE PDF (112 Pages) Containing 51 Useful Python Programs.

pyython developer roadmap

Aspiring to be a Python developer?

Download a FREE PDF on how to become a Python developer.

Let’s be friends

Be the first to know about sales and special discounts.