MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / shape

Method shape

tools/python-3.11.9-amd64/Lib/turtle.py:2754–2779  ·  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 mus

(self, name=None)

Source from the content-addressed store, hash-verified

2752 return q
2753
2754 def shape(self, name=None):
2755 """Set turtle shape to shape with given name / return current shapename.
2756
2757 Optional argument:
2758 name -- a string, which is a valid shapename
2759
2760 Set turtle shape to shape with given name or, if name is not given,
2761 return name of current shape.
2762 Shape with name must exist in the TurtleScreen's shape dictionary.
2763 Initially there are the following polygon shapes:
2764 'arrow', 'turtle', 'circle', 'square', 'triangle', 'classic'.
2765 To learn about how to deal with shapes see Screen-method register_shape.
2766
2767 Example (for a Turtle instance named turtle):
2768 >>> turtle.shape()
2769 'arrow'
2770 >>> turtle.shape("turtle")
2771 >>> turtle.shape()
2772 'turtle'
2773 """
2774 if name is None:
2775 return self.turtle.shapeIndex
2776 if not name in self.screen.getshapes():
2777 raise TurtleGraphicsError("There is no shape named %s" % name)
2778 self.turtle._setshape(name)
2779 self._update()
2780
2781 def shapesize(self, stretch_wid=None, stretch_len=None, outline=None):
2782 """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