MCPcopy Index your code
hub / github.com/python/cpython / shape

Method shape

Lib/turtle.py:2885–2910  ·  view source on GitHub ↗

Set turtle shape to shape with given name / return current shapename. Optional argument: name -- a string, which is a valid shapename Set turtle shape to shape with given name or, if name is not given, return name of current shape. Shape with name must exist

(self, name=None)

Source from the content-addressed store, hash-verified

2883 return q
2884
2885 def shape(self, name=None):
2886 """Set turtle shape to shape with given name / return current shapename.
2887
2888 Optional argument:
2889 name -- a string, which is a valid shapename
2890
2891 Set turtle shape to shape with given name or, if name is not given,
2892 return name of current shape.
2893 Shape with name must exist in the TurtleScreen's shape dictionary.
2894 Initially there are the following polygon shapes:
2895 'arrow', 'turtle', 'circle', 'square', 'triangle', 'classic'.
2896 To learn about how to deal with shapes see Screen-method register_shape.
2897
2898 Example (for a Turtle instance named turtle):
2899 >>> turtle.shape()
2900 'arrow'
2901 >>> turtle.shape("turtle")
2902 >>> turtle.shape()
2903 'turtle'
2904 """
2905 if name is None:
2906 return self.turtle.shapeIndex
2907 if not name in self.screen.getshapes():
2908 raise TurtleGraphicsError("There is no shape named %s" % name)
2909 self.turtle._setshape(name)
2910 self._update()
2911
2912 def shapesize(self, stretch_wid=None, stretch_len=None, outline=None):
2913 """Set/return turtle's stretchfactors/outline. Set resizemode to "user".

Callers 5

demo2Function · 0.80
__init__Method · 0.80
__init__Method · 0.80
setupFunction · 0.80
mainFunction · 0.80

Calls 4

_updateMethod · 0.95
TurtleGraphicsErrorClass · 0.85
getshapesMethod · 0.80
_setshapeMethod · 0.80

Tested by

no test coverage detected