MCPcopy Create free account
hub / github.com/PageBot/PageBot / rect

Method rect

Lib/pagebot/elements/polygon.py:170–186  ·  view source on GitHub ↗

Creates a rectangle polygon. >>> e = Polygon() >>> e.rect(10, 10, 220, 330) >>> e.points [(10pt, 10pt), (10pt, 340pt), (230pt, 340pt), (230pt, 10pt)] >>> e.block (220pt, 330pt)

(self, x, y, w, h)

Source from the content-addressed store, hash-verified

168 box = property(_get_box)
169
170 def rect(self, x, y, w, h):
171 """Creates a rectangle polygon.
172
173 >>> e = Polygon()
174 >>> e.rect(10, 10, 220, 330)
175 >>> e.points
176 [(10pt, 10pt), (10pt, 340pt), (230pt, 340pt), (230pt, 10pt)]
177 >>> e.block
178 (220pt, 330pt)
179 """
180 self.points = []
181 # Relative offset to (self.x, self.y).
182 self.append((x, y))
183 self.append((x, y+h))
184 self.append((x+w, y+h))
185 self.append((x+w, y))
186 self.closePath = True
187
188 def _get_block(self):
189 """Answers the bounding box of the contained points,

Callers 15

buildMethod · 0.45
_drawNameLabelMethod · 0.45
buildFrameMethod · 0.45
buildMethod · 0.45
_get_childClipPathMethod · 0.45
buildMethod · 0.45
buildMethod · 0.45
buildMethod · 0.45
buildMethod · 0.45
build_indsMethod · 0.45
buildMethod · 0.45
drawFrameMethod · 0.45

Calls 1

appendMethod · 0.95

Tested by

no test coverage detected