MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / addcomponent

Method addcomponent

tools/python-3.11.9-amd64/Lib/turtle.py:894–915  ·  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

(self, poly, fill, outline=None)

Source from the content-addressed store, hash-verified

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
918class Tbuffer(object):

Callers 2

mainFunction · 0.95
mainFunction · 0.95

Calls 2

TurtleGraphicsErrorClass · 0.85
appendMethod · 0.45

Tested by

no test coverage detected