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

Method circle

Lib/pagebot/contexts/svgcontext/svgcontext.py:259–277  ·  view source on GitHub ↗

Circle draws a DrawBot oval with (x,y) as middle point and radius r. >>> from pagebot.toolbox.color import color, blackColor >>> path = '_export/SvgContext_circle.svg' >>> context = SvgContext() >>> context.newPage(1000, 1000) >>> context.fill(color(r=1, g=0,

(self, x, y, r)

Source from the content-addressed store, hash-verified

257 self._drawing.add(oval)
258
259 def circle(self, x, y, r):
260 """Circle draws a DrawBot oval with (x,y) as middle point and radius r.
261
262 >>> from pagebot.toolbox.color import color, blackColor
263 >>> path = '_export/SvgContext_circle.svg'
264 >>> context = SvgContext()
265 >>> context.newPage(1000, 1000)
266 >>> context.fill(color(r=1, g=0, b=0.5))
267 >>> context.circle(pt(0), pt(100), pt(300))
268 >>> context.stroke(blackColor, pt(20))
269 >>> context.fill(color(r=0.6, g=0.1, b=0.5))
270 >>> context.circle(pt(300), pt(150), pt(200))
271 >>> context.saveDrawing(path)
272 >>> #r = os.system('open %s' % path)
273 """
274 circle = self._drawing.circle(center=upt((self._ox+x+r),
275 (self._oy+y+r)), r=upt(r), stroke_width=upt(self._strokeWidth),
276 stroke=self._svgStroke, fill=self._svgFill)
277 self._drawing.add(circle)
278
279 def line(self, p1, p2):
280 """Draw a line from p1 to p2.

Callers 4

_drawRegistrationMarkMethod · 0.45
_drawRegistrationMarkMethod · 0.45
_drawFontCircleMethod · 0.45

Calls 2

uptFunction · 0.90
addMethod · 0.80

Tested by

no test coverage detected