@@ -1224,7 +1224,7 @@ def setworldcoordinates(self, llx, lly, urx, ury):
12241224 self ._rescale (self .xscale / oldxscale , self .yscale / oldyscale )
12251225 self .update ()
12261226
1227- def register_shape (self , name , shape = None ):
1227+ def register_shape (self , name , shape = None , rotate_image_shape = False ):
12281228 """Adds a turtle shape to TurtleScreen's shapelist.
12291229
12301230 Arguments:
@@ -1236,6 +1236,7 @@ def register_shape(self, name, shape=None):
12361236 Installs the corresponding image shape.
12371237 !! Image-shapes DO NOT rotate when turning the turtle,
12381238 !! so they do not display the heading of the turtle!
1239+ !! unless rotate_image_shape is explicitly set to true
12391240 (3) name is an arbitrary string and shape is a tuple
12401241 of pairs of coordinates. Installs the corresponding
12411242 polygon shape
@@ -1246,15 +1247,17 @@ def register_shape(self, name, shape=None):
12461247
12471248 call: register_shape("turtle.gif")
12481249 --or: register_shape("tri", ((0,0), (10,10), (-10,10)))
1250+ --or: register_shape("turtle.gif", rotate_image_shape=True)
12491251
12501252 Example (for a TurtleScreen instance named screen):
12511253 >>> screen.register_shape("triangle", ((5,-3),(0,5),(-5,-3)))
12521254
12531255 """
1256+ image_shape_type = "transformable_image" if rotate_image_shape else "image"
12541257 if shape is None :
1255- shape = Shape ("image" , self ._image (name ))
1258+ shape = Shape (image_shape_type , self ._image (name ))
12561259 elif isinstance (shape , str ):
1257- shape = Shape ("image" , self ._image (shape ))
1260+ shape = Shape (image_shape_type , self ._image (shape ))
12581261 elif isinstance (shape , tuple ):
12591262 shape = Shape ("polygon" , shape )
12601263 ## else shape assumed to be Shape-instance
0 commit comments