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.
Contact Us