无法添加形状(图片)
Cant Add Shape (image)
我正在尝试将图像添加到我的代码中,但它不断引发错误
Bad arguments for register_shape
我正在学习 http://blog.trinket.io/using-images-in-turtle-programs/
上的教程
我的代码是:
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")
背景有效。
您可以在这里寻找答案:
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.
我正在尝试将图像添加到我的代码中,但它不断引发错误
Bad arguments for register_shape
我正在学习 http://blog.trinket.io/using-images-in-turtle-programs/
上的教程我的代码是:
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")
背景有效。
您可以在这里寻找答案:
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.