so im creating a snake game using Python turtle module. currently im drawing the head of the snake, using this code:
# Snake head
head = turtle.Turtle() # create an instance of the class turtle called 'head'
head.speed(0) # call the speed method
head.shape("square") # defines the shape of the snakes head
head.color("black") # defines the colour of the snakes head
head.penup() # stop the snake from drawing when moving
head.goto(0,0) # moves the snakes head to the coordinates 0,0 on the screen.
head.direction = "stop" # stops the turtles head from moving strait away
Instead of drawing, i would like to import an image and use it as the snakes head. here is the code so far
image1 = "D:\Desktop\computing\Python\snake game\img\snake_head.png"
head = turtle.Turtle()
head.speed(0)
head.addshape(image1)
head.goto(0,0)
head.direction = "stop"
after doing some research i found here, you could use a method called "addshape" to import the image. however when i run the code i get the error:
AttributeError: 'Turtle' object has no attribute 'addshape'