当前位置:   article > 正文

pythonturtle怎么导入背景,如何在Python Turtle中导入图像?

如何在turtle 里面导入图片

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?

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/人工智能uu/article/detail/874213
推荐阅读
相关标签
  

闽ICP备14008679号