How to use images for Turtle cursor In Python

To use an image as the cursor, we need to pass the image file path as parameter to register_shape(). Note that this image has to be in gif format.

Python3




import turtle
 
# turtle object
img_turtle = turtle.Turtle()
  
# registering the image
# as a new shape
turtle.register_shape('example.gif')
 
# setting the image as cursor
img_turtle.shape('example.gif')


Output : 
 


How to Create custom Turtle shapes in Python?

In Turtle, by default, we have an arrowhead-shaped cursor for drawing on the canvas. This can be changed to some other predefined shape or we can also create a custom shape and register it under a name. Not just that, we can even use gif format images to replace our cursor.

Similar Reads

Changing cursor to predefined shapes

The shape() function is used to set the shape of the cursor. The pre-defined shapes include turtle, arrow, circle, square and triangle....

Registering new shapes

...

Using images for Turtle cursor

The turtle module has register_shape() function for registering custom shapes....

Contact Us