23 Sep turtle.getshapes() function in Python
The turtle.getshapes() function returns a list of names of all currently available turtle shapes. This includes both built-in and user-defined shapes.
Syntax: turtle.getshapes()
Parameters: None.
Let us see an example to implement the turtle.getshapes() function in Python:
Demo65.py
# turtle.getshapes() function in Python
# Code by Studyopedia
import turtle
window = turtle.Screen()
t = turtle.Turtle()
# Get list of available shapes
shapes = turtle.getshapes()
print("Available shapes:", shapes)
window.exitonclick()
The following is the output:

In the above code, we followed the below steps:
- Import module:
import turtleloads the turtle graphics library. - Create screen:
window = turtle.Screen()opens the drawing window. - Create turtle:
t = turtle.Turtle()creates the turtle you’ll control. - Get available shapes:
shapes = turtle.getshapes()retrieves a list of all registered turtle shapes (e.g.,"arrow","turtle","circle","square","triangle","classic"). You can also register custom shapes usingregister_shape(). - Print shapes:
print("Available shapes:", shapes)displays the list of shape names in the console. - Close on click:
window.exitonclick()waits for a mouse click, then closes the window.
If you liked the tutorial, spread the word and share the link and our website, Studyopedia, with others.
For Videos, Join Our YouTube Channel: Join Now
Read More:
- OpenCV Tutorial
- Python Tutorial
- NumPy Tutorial
- Pandas Tutorial
- Matplotlib Tutorial
- Generative AI Tutorial
- LangChain Tutorial
- RAG Tutorial
- Machine Learning Tutorial
- Deep Learning Tutorial
- Ollama Tutorial
- Retrieval Augmented Generation (RAG) Tutorial
- Copilot Tutorial
- Gemini Tutorial
- ChatGPT Tutorial
No Comments