1586010002-jmsa.png

What I want, is to get an image to replace the default turtle, just like it is done here: http://blog.trinket.io/using-images-in-turtle-programs/ .

This is my code, but I don't know why it doesn't work:

import turtle

image = "C:/Python27/Pythonprogramming/image.png"

screen = turtle.Screen()

screen.addshape(image)

turtle.shape(image)

turtle.mainloop()

This is all in effort to make a turtle that's actions can be manipulated through Python code. I have searched all over the internet, but can't seem to find a solution.

Thanks in advance for any help!

解决方案

I'm not sure but I think on Windows ,the paths will be like this:

"C:\Python2\Pythonprogramming\image.png"

Also , what error does it raise exactly?

Logo

汇聚全球AI编程工具,助力开发者即刻编程。

更多推荐