3

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.

ggorlen
  • 44,755
  • 7
  • 76
  • 106
Izak the coder
  • 65
  • 1
  • 2
  • 6
  • Does this answer your question? [adding an image to the Turtle Screen](https://stackoverflow.com/questions/30427742/adding-an-image-to-the-turtle-screen) – ggorlen Dec 17 '22 at 21:42

3 Answers3

2

The turtle graphics has support for .gif images only. Please try to change your image's format.

Here's a link to a similar question How can i add an image (Python)

Community
  • 1
  • 1
HENOK MILLION
  • 309
  • 1
  • 9
-1

Trinket is a program for python! You have to type your code in trinket if you want that code to work!

Dan Cod
  • 9
  • 1
-1

this picture must be in the same folder with doc.py . And then you can write name of the picture: img.gif

yurew
  • 1
  • It's true that the image needs to be a gif, but it'd be best if you provided actual code to load the image (as other answers already do). – ggorlen Dec 17 '22 at 21:47