A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.geeksforgeeks.org/python/draw-a-tic-tac-toe-board-using-python-turtle/ below:

Draw a Tic Tac Toe Board using Python-Turtle

Draw a Tic Tac Toe Board using Python-Turtle

Last Updated : 15 Jul, 2025

The Task Here is to Make a Tic Tac Toe board layout using Turtle Graphics in Python. For that lets first know what is Turtle Graphics.

Turtle graphics

In computer graphics, turtle graphics are vector graphics using a relative cursor upon a Cartesian plane. Turtle is drawing board like feature which let us to command a turtle and draw using it.

Features of turtle graphics:

Approach
import turtle
ws = turtle.Screen()

The screen will look like this.

Screen

Below is the implementation of the above approach:

Python3
import turtle 


# getting a Screen to work on 
ws=turtle.Screen()

# Defining Turtle instance
t=turtle.Turtle()

# setting up turtle color to green 
t.color("Green")

# Setting Up width to 2
t.width("2")

# Setting up speed to 2
t.speed(2)

# Loop for making outside square of
# length 300
for i in range(4):
    t.forward(300)
    t.left(90)


# code for inner lines of the square
t.penup()
t.goto(0,100)
t.pendown()

t.forward(300)

t.penup()
t.goto(0,200)
t.pendown()

t.forward(300)

t.penup()
t.goto(100,0)
t.pendown()

t.left(90)
t.forward(300)

t.penup()
t.goto(200,0)
t.pendown()


t.forward(300)

Output:

Turtle making Tic Tac Toe Board

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4