Add component to a shape of type compound. Arguments: poly is a polygon, i. e. a tuple of number pairs. fill is the fillcolor of the component, outline is the outline color of the component. call (for a Shapeobject namend s): -- s.addcomponent(((0,0
(self, poly, fill, outline=None)
| 892 | self._data = data |
| 893 | |
| 894 | def addcomponent(self, poly, fill, outline=None): |
| 895 | """Add component to a shape of type compound. |
| 896 | |
| 897 | Arguments: poly is a polygon, i. e. a tuple of number pairs. |
| 898 | fill is the fillcolor of the component, |
| 899 | outline is the outline color of the component. |
| 900 | |
| 901 | call (for a Shapeobject namend s): |
| 902 | -- s.addcomponent(((0,0), (10,10), (-10,10)), "red", "blue") |
| 903 | |
| 904 | Example: |
| 905 | >>> poly = ((0,0),(10,-5),(0,10),(-10,-5)) |
| 906 | >>> s = Shape("compound") |
| 907 | >>> s.addcomponent(poly, "red", "blue") |
| 908 | >>> # .. add more components and then use register_shape() |
| 909 | """ |
| 910 | if self._type != "compound": |
| 911 | raise TurtleGraphicsError("Cannot add component to %s Shape" |
| 912 | % self._type) |
| 913 | if outline is None: |
| 914 | outline = fill |
| 915 | self._data.append([poly, fill, outline]) |
| 916 | |
| 917 | |
| 918 | class Tbuffer(object): |
no test coverage detected