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

Method addcomponent

Lib/turtle.py:884–905  ·  view source on GitHub ↗

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), (10,

(self, poly, fill, outline=None)

Source from the content-addressed store, hash-verified

882 self._data = data
883
884 def addcomponent(self, poly, fill, outline=None):
885 """Add component to a shape of type compound.
886
887 Arguments: poly is a polygon, i. e. a tuple of number pairs.
888 fill is the fillcolor of the component,
889 outline is the outline color of the component.
890
891 call (for a Shapeobject namend s):
892 -- s.addcomponent(((0,0), (10,10), (-10,10)), "red", "blue")
893
894 Example:
895 >>> poly = ((0,0),(10,-5),(0,10),(-10,-5))
896 >>> s = Shape("compound")
897 >>> s.addcomponent(poly, "red", "blue")
898 >>> # .. add more components and then use register_shape()
899 """
900 if self._type != "compound":
901 raise TurtleGraphicsError("Cannot add component to %s Shape"
902 % self._type)
903 if outline is None:
904 outline = fill
905 self._data.append([poly, fill, outline])
906
907
908class Tbuffer(object):

Callers 2

mainFunction · 0.95
mainFunction · 0.95

Calls 2

TurtleGraphicsErrorClass · 0.85
appendMethod · 0.45

Tested by

no test coverage detected