circle
Various common shapes for use with displayio - Circle shape!
Author(s): Limor Fried
Implementation Notes
Software and Dependencies:
Adafruit CircuitPython firmware for the supported boards: https://github.com/adafruit/circuitpython/releases
- class adafruit_display_shapes.circle.Circle(*args: Any, **kwargs: Any)
A circle.
- Parameters:
x0 (int) – The x-position of the center.
y0 (int) – The y-position of the center.
r (int) – The radius of the circle.
fill (int|None) – The color to fill the circle. Can be a hex value for a color or
None
for transparent.outline (int|None) – The outline of the circle. Can be a hex value for a color or
None
for no outline.stroke (int) – Used for the outline. Will not change the radius.
rect
Various common shapes for use with displayio - Rectangle shape!
Author(s): Limor Fried
Implementation Notes
Software and Dependencies:
Adafruit CircuitPython firmware for the supported boards: https://github.com/adafruit/circuitpython/releases
- class adafruit_display_shapes.rect.Rect(*args: Any, **kwargs: Any)
A rectangle.
- Parameters:
x (int) – The x-position of the top left corner.
y (int) – The y-position of the top left corner.
width (int) – The width of the rectangle.
height (int) – The height of the rectangle.
fill (int|None) – The color to fill the rectangle. Can be a hex value for a color or
None
for transparent.outline (int|None) – The outline of the rectangle. Can be a hex value for a color or
None
for no outline.stroke (int) – Used for the outline. Will not change the outer bound size set by
width
andheight
.
- property fill: int | None
The fill of the rectangle. Can be a hex value for a color or
None
for transparent.
roundrect
A slightly modified version of Adafruit_CircuitPython_Display_Shapes that includes an explicit call to palette.make_opaque() in the fill color setter function.
- class adafruit_display_shapes.roundrect.RoundRect(*args: Any, **kwargs: Any)
A round-corner rectangle.
- Parameters:
x (int) – The x-position of the top left corner.
y (int) – The y-position of the top left corner.
width (int) – The width of the rounded-corner rectangle.
height (int) – The height of the rounded-corner rectangle.
r (int) – The radius of the rounded corner.
fill (int|None) – The color to fill the rounded-corner rectangle. Can be a hex value for a color or
None
for transparent.outline (int|None) – The outline of the rounded-corner rectangle. Can be a hex value for a color or
None
for no outline.stroke (int) – Used for the outline. Will not change the outer bound size set by
width
andheight
.
- property fill: int | None
The fill of the rounded-corner rectangle. Can be a hex value for a color or
None
for transparent.
triangle
Various common shapes for use with displayio - Triangle shape!
Author(s): Melissa LeBlanc-Williams
Implementation Notes
Software and Dependencies:
Adafruit CircuitPython firmware for the supported boards: https://github.com/adafruit/circuitpython/releases
- class adafruit_display_shapes.triangle.Triangle(*args: Any, **kwargs: Any)
A triangle.
- Parameters:
x0 (int) – The x-position of the first vertex.
y0 (int) – The y-position of the first vertex.
x1 (int) – The x-position of the second vertex.
y1 (int) – The y-position of the second vertex.
x2 (int) – The x-position of the third vertex.
y2 (int) – The y-position of the third vertex.
fill (int|None) – The color to fill the triangle. Can be a hex value for a color or
None
for transparent.outline (int|None) – The outline of the triangle. Can be a hex value for a color or
None
for no outline.
line
Various common shapes for use with displayio - Line shape!
Author(s): Melissa LeBlanc-Williams
Implementation Notes
Software and Dependencies:
Adafruit CircuitPython firmware for the supported boards: https://github.com/adafruit/circuitpython/releases
- class adafruit_display_shapes.line.Line(*args: Any, **kwargs: Any)
A line.
- Parameters:
polygon
Various common shapes for use with displayio - Polygon shape!
Author(s): Melissa LeBlanc-Williams
Implementation Notes
Software and Dependencies:
Adafruit CircuitPython firmware for the supported boards: https://github.com/adafruit/circuitpython/releases
- class adafruit_display_shapes.polygon.Polygon(*args: Any, **kwargs: Any)
A polygon.
- Parameters:
points (list) – A list of (x, y) tuples of the points
outline (int|None) – The outline of the polygon. Can be a hex value for a color or
None
for no outline.close (bool) – (Optional) Wether to connect first and last point. (True)
colors (int) – (Optional) Number of colors to use. Most polygons would use two, one for outline and one for fill. If you’re not filling your polygon, set this to 1 for smaller memory footprint. (2)
- static draw(bitmap: displayio.Bitmap, points: List[Tuple[int, int]], color_id: int, close: bool | None = True) None
Draw a polygon conecting points on provided bitmap with provided color_id
- Parameters:
bitmap (displayio.Bitmap) – bitmap to draw on
points (list) – A list of (x, y) tuples of the points
color_id (int) – Color to draw with
close (bool) – (Optional) Wether to connect first and last point. (True)
sparkline
Various common shapes for use with displayio - Sparkline!
Author(s): Kevin Matocha
Implementation Notes
Software and Dependencies:
Adafruit CircuitPython firmware for the supported boards: https://github.com/adafruit/circuitpython/releases
- class adafruit_display_shapes.sparkline.Sparkline(*args: Any, **kwargs: Any)
A sparkline graph.
- Parameters:
width (int) – Width of the sparkline graph in pixels
height (int) – Height of the sparkline graph in pixels
max_items (int) – Maximum number of values housed in the sparkline
dyn_xpitch (bool) – (Optional) Dynamically change xpitch (True)
y_min (int|None) – Lower range for the y-axis. Set to None for autorange.
y_max (int|None) – Upper range for the y-axis. Set to None for autorange.
x (int) – X-position on the screen, in pixels
y (int) – Y-position on the screen, in pixels
color (int) – Line color, the default value is 0xFFFFFF (WHITE)
Note: If dyn_xpitch is True (default), the sparkline will allways span the complete width. Otherwise, the sparkline will grow when you add values. Once the line has reached the full width, the sparkline will scroll to the left.
- add_value(value: float, update: bool = True) None
Add a value to the sparkline.
- Parameters:
Note: when adding multiple values it is more efficient to call this method with parameter ‘update=False’ and then to manually call the update()-method
arc
Various common shapes for use with displayio - Arc shape!
Author(s): Bernhard Bablok
Implementation Notes
Software and Dependencies:
Adafruit CircuitPython firmware for the supported boards: https://github.com/adafruit/circuitpython/releases
- class adafruit_display_shapes.arc.Arc(*args: Any, **kwargs: Any)
An arc. Technically, an arc is a Group with one or two polygons.
An arc is defined by a radius, an angle (in degrees) and a direction (also in degrees). The latter is the direction of the midpoint of the arc.
The direction-parameter uses the layout of polar-coordinates, i.e. zero points to the right, 90 to the top, 180 to the left and 270 to the bottom.
The Arc-class creates the arc as a polygon. The number of segments define how round the arc is. There is a memory-tradeoff if the segment-number is large.
- Parameters:
radius (float) – The (outer) radius of the arc.
angle (float) – The angle of the arc in degrees.
direction (float) – The direction of the middle-point of the arc in degrees (0)
segments (int) – The number of segments of the arc.
int (arc_width) – (Optional) The width of the arc. This creates an inner arc as well.
outline (int|None) – The outline of the arc. Can be a hex value for a color or
None
for no outline.fill (int|None) – The fill-color of the arc. Can be a hex value for a color or
None
for no filling. Ignored if port does not support vectorio.