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

Method _setshape

Lib/turtle.py:2574–2593  ·  view source on GitHub ↗
(self, shapeIndex)

Source from the content-addressed store, hash-verified

2572 self._setshape(shapeIndex)
2573
2574 def _setshape(self, shapeIndex):
2575 screen = self.screen
2576 self.shapeIndex = shapeIndex
2577 if self._type == "polygon" == screen._shapes[shapeIndex]._type:
2578 return
2579 if self._type == "image" == screen._shapes[shapeIndex]._type:
2580 return
2581 if self._type in ["image", "polygon"]:
2582 screen._delete(self._item)
2583 elif self._type == "compound":
2584 for item in self._item:
2585 screen._delete(item)
2586 self._type = screen._shapes[shapeIndex]._type
2587 if self._type == "polygon":
2588 self._item = screen._createpoly()
2589 elif self._type == "image":
2590 self._item = screen._createimage(screen._shapes["blank"]._data)
2591 elif self._type == "compound":
2592 self._item = [screen._createpoly() for item in
2593 screen._shapes[shapeIndex]._data]
2594
2595
2596class RawTurtle(TPen, TNavigator):

Callers 2

__init__Method · 0.95
shapeMethod · 0.80

Calls 3

_createpolyMethod · 0.80
_createimageMethod · 0.80
_deleteMethod · 0.45

Tested by

no test coverage detected