Skip to content

Commit 591eef7

Browse files
committed
Doc
1 parent aaf9722 commit 591eef7

File tree

3 files changed

+29
-1
lines changed

3 files changed

+29
-1
lines changed

docs/source/drawing_shapes.rst

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,34 @@ You can also clear a certain canvas rectangle area:
6666
6767
.. image:: images/rects.png
6868

69+
Drawing circles
70+
---------------
71+
72+
There are four methods that draw circles on the canvas:
73+
74+
- ``fill_arc(x, y, radius, start_angle, end_angle, anticlockwise=False)``: Draw a filled arc centered at ``(x, y)`` with a radius of ``radius``.
75+
- ``stroke_arc(x, y, radius, start_angle, end_angle, anticlockwise=False)``: Draw an arc outline centered at ``(x, y)`` with a radius of ``radius``.
76+
- ``fill_arcs(x, y, radius, start_angle, end_angle, anticlockwise=False)``: Draw filled arcs centered at ``(x, y)`` with a radius of ``radius``. Where ``x``, ``y``, ``radius`` and other arguments are NumPy arrays, lists or scalar values.
77+
- ``stroke_arcs(x, y, radius, start_angle, end_angle, anticlockwise=False)``: Draw an arc outlines centered at ``(x, y)`` with a radius of ``radius``. Where ``x``, ``y``, ``radius`` and other arguments are NumPy arrays, lists or scalar values.
78+
79+
.. code:: Python
80+
81+
from math import pi
82+
83+
from ipycanvas import Canvas
84+
85+
canvas = Canvas(size=(200, 200))
86+
87+
canvas.fill_style = 'red'
88+
canvas.stroke_style = 'blue'
89+
90+
canvas.fill_arc(60, 60, 50, 0, pi)
91+
canvas.stroke_arc(60, 60, 40, 0, 2 * pi)
92+
93+
canvas
94+
95+
.. image:: images/arc.png
96+
6997
Drawing paths
7098
-------------
7199

docs/source/images/arc.png

4.19 KB
Loading

ipycanvas/canvas.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ def fill_arcs(self, x, y, radius, start_angle, end_angle, anticlockwise=False):
191191
self._send_canvas_command('fillArcs', args, buffers)
192192

193193
def stroke_arcs(self, x, y, radius, start_angle, end_angle, anticlockwise=False):
194-
"""Draw a rectangular outlines centered at ``(x, y)`` with a radius of ``radius``.
194+
"""Draw an arc outlines centered at ``(x, y)`` with a radius of ``radius``.
195195
196196
Where ``x``, ``y``, ``radius`` and other arguments are NumPy arrays, lists or scalar values.
197197
"""

0 commit comments

Comments
 (0)