When I first started exploring Python’s Turtle module, I wanted to create simple graphics that could help visualize data and patterns. One of the most useful and foundational things I learned was how to draw grids using Turtle.
In this tutorial, I’ll share several methods to create grids using Python Turtle. I’ll explain each method based on my firsthand experience, so you can choose the one that suits your project best.
Methods to Create a Grid with Python Turtle
Grids are everywhere — from city maps to game boards like chess or Battleship. When I was working on a project that required plotting coordinates (like mapping US states on a grid), drawing a grid helped me visualize the data clearly. A grid helps divide the screen into manageable sections, making it easier to place elements precisely.
1: Draw a Simple Static Grid Using Loops
The simplest way I found to create a grid is by using loops to draw horizontal and vertical lines. This method works well if you want a static grid that doesn’t change size dynamically.
Here’s how I did it:
import turtle
def draw_grid(size, step):
turtle.speed(0)
turtle.color("gray")
# Draw vertical lines
for x in range(-size, size + 1, step):
turtle.penup()
turtle.goto(x, -size)
turtle.pendown()
turtle.goto(x, size)
# Draw horizontal lines
for y in range(-size, size + 1, step):
turtle.penup()
turtle.goto(-size, y)
turtle.pendown()
turtle.goto(size, y)
turtle.hideturtle()
turtle.done()
draw_grid(200, 20)You can see the output in the screenshot below.

Explanation:
sizedetermines how far the grid extends in each direction (like ±200 units).stepcontrols the spacing between grid lines (e.g., 20 units).- The two loops draw vertical and horizontal lines respectively.
- I used
penup()andpendown()to move the turtle without drawing unwanted lines.
This method is quick and effective for fixed-size grids.
2: Dynamic Grid Based on Screen Size
Sometimes, I needed a grid that fills the entire Turtle screen, regardless of the screen size. Here’s how I adapted the first method to be dynamic:
import turtle
def draw_dynamic_grid(step):
screen = turtle.Screen()
width, height = screen.window_width() // 2, screen.window_height() // 2
turtle.speed(0)
turtle.color("lightblue")
# Draw vertical lines
for x in range(-width, width + 1, step):
turtle.penup()
turtle.goto(x, -height)
turtle.pendown()
turtle.goto(x, height)
# Draw horizontal lines
for y in range(-height, height + 1, step):
turtle.penup()
turtle.goto(-width, y)
turtle.pendown()
turtle.goto(width, y)
turtle.hideturtle()
turtle.done()
draw_dynamic_grid(25)You can see the output in the screenshot below.

What I like about this method:
- It automatically adjusts to the window size.
- You don’t have to hardcode grid dimensions.
- The grid lines are spaced evenly based on your chosen
step.
Check out Python Turtle Polygon
3: Use Functions for Reusability and Customization
In real projects, I often needed grids with different colors, line thicknesses, or even labels for rows and columns. To make this easier, I wrapped the grid drawing logic inside a function with customizable parameters:
import turtle
def draw_custom_grid(size=300, step=30, line_color="black", line_thickness=1, label=False):
turtle.speed(0)
turtle.color(line_color)
turtle.pensize(line_thickness)
# Draw vertical lines
for x in range(-size, size + 1, step):
turtle.penup()
turtle.goto(x, -size)
turtle.pendown()
turtle.goto(x, size)
if label:
turtle.penup()
turtle.goto(x, -size - 15)
turtle.write(str(x), align="center", font=("Arial", 8, "normal"))
# Draw horizontal lines
for y in range(-size, size + 1, step):
turtle.penup()
turtle.goto(-size, y)
turtle.pendown()
turtle.goto(size, y)
if label:
turtle.penup()
turtle.goto(-size - 20, y - 5)
turtle.write(str(y), align="right", font=("Arial", 8, "normal"))
turtle.hideturtle()
turtle.done()
# Example usage:
draw_custom_grid(size=250, step=50, line_color="green", line_thickness=2, label=True)You can see the output in the screenshot below.

Why this method works well:
- You can easily change grid size, spacing, color, and thickness.
- Adding labels helps when you want to map coordinates (like plotting US cities or landmarks).
- I found labeling especially helpful when working on educational projects or demos.
Read Python Turtle Window
4: Create a Grid with Color Alternating Cells (Checkerboard Style)
If you want to build a game board or something visually appealing, coloring the grid cells alternately is a great idea. Here’s how I approached this:
import turtle
def draw_checkerboard_grid(rows, cols, cell_size):
turtle.speed(0)
turtle.penup()
start_x = -cols * cell_size / 2
start_y = rows * cell_size / 2
for row in range(rows):
for col in range(cols):
x = start_x + col * cell_size
y = start_y - row * cell_size
turtle.goto(x, y)
turtle.pendown()
if (row + col) % 2 == 0:
turtle.fillcolor("white")
else:
turtle.fillcolor("black")
turtle.begin_fill()
for _ in range(4):
turtle.forward(cell_size)
turtle.right(90)
turtle.end_fill()
turtle.penup()
turtle.hideturtle()
turtle.done()
# Example usage:
draw_checkerboard_grid(8, 8, 40)
How this helped me:
- This method is perfect for creating chess or checkerboards.
- The alternating colors make it visually easy to distinguish cells.
- You can modify colors and sizes to fit your project.
Check out Python Turtle Random
Tips for Working with Python Turtle Grids
- Use
turtle.speed(0)to draw grids fast without animation delays. - Hide the turtle cursor with
turtle.hideturtle()once the drawing is done for cleaner visuals. - Use
turtle.tracer(0)andturtle.update()if you want to speed up drawing complex grids by disabling animation temporarily. - Labeling your grid is useful when working on coordinate-based projects like US maps or city layouts.
- Experiment with colors and line thickness to make your grid visually appealing and suitable for presentations.
Creating grids with Python Turtle has been a game-changer in many of my projects. Whether it’s for educational tools, simple games, or data visualization, grids provide a structured way to organize your graphics.
By using the methods I shared, you can start with a simple grid and then customize it to fit your needs. Python Turtle is flexible, and with a few lines of code, you can create grids that help you build more complex projects.
If you’re new to Turtle or Python, try these examples one at a time and tweak the parameters. Soon, you’ll be able to create grids that serve as the backbone for your graphical applications.
You may also like to read:

I am Bijay Kumar, a Microsoft MVP in SharePoint. Apart from SharePoint, I started working on Python, Machine learning, and artificial intelligence for the last 5 years. During this time I got expertise in various Python libraries also like Tkinter, Pandas, NumPy, Turtle, Django, Matplotlib, Tensorflow, Scipy, Scikit-Learn, etc… for various clients in the United States, Canada, the United Kingdom, Australia, New Zealand, etc. Check out my profile.