MCPcopy Index your code
hub / github.com/clips/pattern / draw

Method draw

pattern/graph/__init__.py:253–264  ·  view source on GitHub ↗

Draws the edge as a line with the given stroke and strokewidth (increased with Edge.weight). Override this method in a subclass for custom drawing.

(self, weighted=False, directed=False)

Source from the content-addressed store, hash-verified

251 weight = property(_get_weight, _set_weight)
252
253 def draw(self, weighted=False, directed=False):
254 """ Draws the edge as a line with the given stroke and strokewidth (increased with Edge.weight).
255 Override this method in a subclass for custom drawing.
256 """
257 w = weighted and self.weight or 0
258 line(
259 self.node1.x,
260 self.node1.y,
261 self.node2.x,
262 self.node2.y, stroke=self.stroke, strokewidth=self.strokewidth+w)
263 if directed:
264 self.draw_arrow(stroke=self.stroke, strokewidth=self.strokewidth+w)
265
266 def draw_arrow(self, **kwargs):
267 """ Draws the direction of the edge as an arrow on the rim of the receiving node.

Callers

nothing calls this directly

Calls 2

draw_arrowMethod · 0.95
lineFunction · 0.70

Tested by

no test coverage detected