Python 无法添加形状(图像)

Python 无法添加形状(图像),python,python-2.7,turtle-graphics,Python,Python 2.7,Turtle Graphics,我试图在代码中添加一个图像,但它不断引发错误 寄存器形状的参数不正确 我现在正在学习教程 我的代码是: 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 sha

我试图在代码中添加一个图像,但它不断引发错误

寄存器形状的参数不正确

我现在正在学习教程

我的代码是:

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)
我正在使用python 2.6。 此外,当我使用

screen.bgpic(“C:…\Backgrounds\giphy2.gif”)


背景工作正常。

您可以在此处查找答案:

turtle模块支持图像,但仅支持GIF图像,不支持PNG或任何其他格式。正如addshape的文档所说:

name是gif文件的名称,shape是None:安装相应的图像形状

r“C:\Users\--myName-->Desktop\Python\FinalPrj\Space\images\Backgrounds\giphy2.gif”
-添加
r
前缀。