MCPcopy Create free account
hub / github.com/codemistic/Data-Structures-and-Algorithms / _setshape

Method _setshape

Python/Turtle.py:2389–2408  ·  view source on GitHub ↗
(self, shapeIndex)

Source from the content-addressed store, hash-verified

2387 self._setshape(shapeIndex)
2388
2389 def _setshape(self, shapeIndex):
2390 screen = self.screen
2391 self.shapeIndex = shapeIndex
2392 if self._type == "polygon" == screen._shapes[shapeIndex]._type:
2393 return
2394 if self._type == "image" == screen._shapes[shapeIndex]._type:
2395 return
2396 if self._type in ["image", "polygon"]:
2397 screen._delete(self._item)
2398 elif self._type == "compound":
2399 for item in self._item:
2400 screen._delete(item)
2401 self._type = screen._shapes[shapeIndex]._type
2402 if self._type == "polygon":
2403 self._item = screen._createpoly()
2404 elif self._type == "image":
2405 self._item = screen._createimage(screen._shapes["blank"]._data)
2406 elif self._type == "compound":
2407 self._item = [screen._createpoly() for item in
2408 screen._shapes[shapeIndex]._data]
2409
2410
2411class RawTurtle(TPen, TNavigator):

Callers 2

__init__Method · 0.95
shapeMethod · 0.80

Calls 3

_deleteMethod · 0.80
_createpolyMethod · 0.80
_createimageMethod · 0.80

Tested by

no test coverage detected