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?
本文介绍了一位开发者尝试用自定义图像替换Python中turtle模块默认图标的过程。作者分享了其使用的代码片段,并遇到了路径配置问题导致的显示错误。通过调整Windows系统下的文件路径格式,最终解决了图像无法正常加载的问题。
1350

被折叠的 条评论
为什么被折叠?



