(self, type_, data=None)
| 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. |
nothing calls this directly
no test coverage detected