Open In App

turtle.get_shapepoly() function in Python

Last Updated : 22 Aug, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

The turtle.get_shapepoly() function is used to return the current turtle shape as a polygon, represented by a tuple of coordinate pairs. Each pair defines a vertex of the polygon.

Syntax:

turtle.get_shapepoly()

  • Parameters: This function takes no arguments.
  • Returns: A tuple of coordinate pairs representing the polygon of the turtle’s current shape.

Examples

Example 1: Getting the default shape polygon

Python
import turtle

print(turtle.shape())
print(turtle.get_shapepoly())

turtle.turtlesize(5, 5, 2)
print(turtle.get_shapepoly())

Output :

classic
((0, 0), (-5, -9), (0, -7), (5, -9))
((0.0, 0.0), (-25.0, -45.0), (0.0, -35.0), (25.0, -45.0))

Example 2 : Getting shapepoly of all available shapes

Python
import turtle

shp=turtle.getshapes()
print(shp)

for i in range(len(shp)):
    turtle.shape(shp[i])
    print(turtle.get_shapepoly())

Output :

['arrow', 'blank', 'circle', 'classic', 'square', 'triangle', 'turtle']
((-10, 0), (10, 0), (0, 10))
None
((10, 0), (9.51, 3.09), (8.09, 5.88), (5.88, 8.09), (3.09, 9.51), (0, 10), (-3.09, 9.51), (-5.88, 8.09),
(-8.09, 5.88), (-9.51, 3.09), (-10, 0), (-9.51, -3.09), (-8.09, -5.88), (-5.88, -8.09), (-3.09, -9.51),
(-0.0, -10.0), (3.09, -9.51), (5.88, -8.09), (8.09, -5.88), (9.51, -3.09))
((0, 0), (-5, -9), (0, -7), (5, -9))
((10, -10), (10, 10), (-10, 10), (-10, -10))
((10, -5.77), (0, 11.55), (-10, -5.77))
((0, 16), (-2, 14), (-1, 10), (-4, 7), (-7, 9), (-9, 8), (-6, 5), (-7, 1), (-5, -3), (-8, -6), (-6, -8),
(-4, -5), (0, -7), (4, -5), (6, -8), (8, -6), (5, -3), (7, 1), (6, 5), (9, 8), (7, 9), (4, 7), (1, 10),
(2, 14))

Explanation:

  • arrow, circle, classic, square, triangle, and turtle return polygon coordinates.
  • blank returns None since it has no defined shape polygon.

Related Articles


Article Tags :
Practice Tags :

Similar Reads