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

Method __init__

Python/Turtle.py:776–790  ·  view source on GitHub ↗
(self, type_, data=None)

Source from the content-addressed store, hash-verified

774 an image or a list constructed using the addcomponent method.
775 """
776 def __init__(self, type_, data=None):
777 self._type = type_
778 if type_ == "polygon":
779 if isinstance(data, list):
780 data = tuple(data)
781 elif type_ == "image":
782 if isinstance(data, str):
783 if data.lower().endswith(".gif") and isfile(data):
784 data = TurtleScreen._image(data)
785 # else data assumed to be Photoimage
786 elif type_ == "compound":
787 data = []
788 else:
789 raise TurtleGraphicsError("There is no shape type %s" % type_)
790 self._data = data
791
792 def addcomponent(self, poly, fill, outline=None):
793 """Add component to a shape of type compound.

Callers

nothing calls this directly

Calls 2

TurtleGraphicsErrorClass · 0.85
_imageMethod · 0.80

Tested by

no test coverage detected