6

I registered the shape of my turtle in my roulette game to a roulette wheel. I want the wheel to spin 3 times. This is my program:

register_shape("wheel.gif")
wheel = None
wheel = turtle.Turtle()
wheel.ht()
wheel.shape("wheel.gif")


wheel.shapesize(5, 5)
wheel.pu()
wheel.ht()
wheel.goto(-200,-200)
wheel.st()
r = 1
for r in range(108):
    wheel.right(10)

The wheel shows up properly but it doesn't seem to spin. I would assume this should work. If not is there any other way. Thank you.

Greg Peckory
  • 7,700
  • 21
  • 67
  • 114

2 Answers2

3

I had the same issue with Python turtle graphics. I circumvented it by registering different images in different rotational states. Then you can use conditional statements to show a suitable image in each partcular state. Hope it helps!

Jere_JBC
  • 31
  • 2
1

I found that this will not be possible, according to the documentation of the register_shape() method:

Note: Image shapes do not rotate when turning the turtle, so they do not display the heading of the turtle!

Reference: http://docs.python.org/library/turtle.html#turtle.register_shape


However, it seems that there are two other ways to use register_shape() which should provide rotation, since the above disclaimer only refers to image shapes.

  1. Using coordinates to draw a polygon shape.
  2. Using a compound shape object (a compound shape consists of multiple polygons).
gary
  • 4,227
  • 3
  • 31
  • 58