I am trying to add a image to my code but it keep raising the error
Bad arguments for register_shape
I am following the tutorial at http://blog.trinket.io/using-images-in-turtle-programs/
my code is:
import turtle
screen = turtle.Screen()
# click the image icon in the top right of the code window to see
# which images are available in this trinket
image = "C:\...\rocketship.png"
# add the shape first then set the turtle shape
screen.addshape(image)
turtle.shape(image)
I am using python 2.6. furthermore when I use the function of
screen.bgpic("C:...\Backgrounds\giphy2.gif")
The background works.
You may look for answers here: How can i add an image (Python)
The turtle module does have support for images, but only GIF images, not PNG or any other format. As the docs for addshape say:
name is the name of a gif-file and shape is None: Install the corresponding image shape.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With