circle

Various common shapes for use with displayio - Circle shape!

  • Author(s): Limor Fried

Implementation Notes

Software and Dependencies:

class adafruit_display_shapes.circle.Circle(x0, y0, r, *, fill=None, outline=None, stroke=1)

A circle.

Parameters:
  • x0 – The x-position of the center.
  • y0 – The y-position of the center.
  • r – The radius of the circle.
  • fill – The color to fill the circle. Can be a hex value for a color or None for transparent.
  • outline – The outline of the circle. Can be a hex value for a color or None for no outline.
  • stroke – Used for the outline. Will not change the radius.
x0

The x-position of the center of the circle.

y0

The y-position of the center of the circle.

rect

Various common shapes for use with displayio - Rectangle shape!

  • Author(s): Limor Fried

Implementation Notes

Software and Dependencies:

class adafruit_display_shapes.rect.Rect(x, y, width, height, *, fill=None, outline=None, stroke=1)

A rectangle.

Parameters:
  • x – The x-position of the top left corner.
  • y – The y-position of the top left corner.
  • width – The width of the rectangle.
  • height – The height of the rectangle.
  • fill – The color to fill the rectangle. Can be a hex value for a color or None for transparent.
  • outline – The outline of the rectangle. Can be a hex value for a color or None for no outline.
  • stroke – Used for the outline. Will not change the outer bound size set by width and height.
fill

The fill of the rectangle. Can be a hex value for a color or None for transparent.

outline

The outline of the rectangle. Can be a hex value for a color or None for no outline.

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(x, y, width, height, r, *, fill=None, outline=None, stroke=1)

A round-corner rectangle.

Parameters:
  • x – The x-position of the top left corner.
  • y – The y-position of the top left corner.
  • width – The width of the rounded-corner rectangle.
  • height – The height of the rounded-corner rectangle.
  • r – The radius of the rounded corner.
  • fill – The color to fill the rounded-corner rectangle. Can be a hex value for a color or None for transparent.
  • outline – The outline of the rounded-corner rectangle. Can be a hex value for a color or None for no outline.
  • stroke – Used for the outline. Will not change the outer bound size set by width and height.
fill

The fill of the rounded-corner rectangle. Can be a hex value for a color or None for transparent.

outline

The outline of the rounded-corner rectangle. Can be a hex value for a color or None for no outline.

triangle

Various common shapes for use with displayio - Triangle shape!

  • Author(s): Melissa LeBlanc-Williams

Implementation Notes

Software and Dependencies:

class adafruit_display_shapes.triangle.Triangle(x0, y0, x1, y1, x2, y2, *, fill=None, outline=None)

A triangle.

Parameters:
  • x0 – The x-position of the first vertex.
  • y0 – The y-position of the first vertex.
  • x1 – The x-position of the second vertex.
  • y1 – The y-position of the second vertex.
  • x2 – The x-position of the third vertex.
  • y2 – The y-position of the third vertex.
  • fill – The color to fill the triangle. Can be a hex value for a color or None for transparent.
  • outline – The outline of the triangle. Can be a hex value for a color or None for no outline.
fill

The fill of the triangle. Can be a hex value for a color or None for transparent.

line

Various common shapes for use with displayio - Line shape!

  • Author(s): Melissa LeBlanc-Williams

Implementation Notes

Software and Dependencies:

class adafruit_display_shapes.line.Line(x0, y0, x1, y1, color)

A line.

Parameters:
  • x0 – The x-position of the first vertex.
  • y0 – The y-position of the first vertex.
  • x1 – The x-position of the second vertex.
  • y1 – The y-position of the second vertex.
  • color – The color of the line.

polygon

Various common shapes for use with displayio - Polygon shape!

  • Author(s): Melissa LeBlanc-Williams

Implementation Notes

Software and Dependencies:

class adafruit_display_shapes.polygon.Polygon(points, *, outline=None)

A polygon.

Parameters:
  • points – A list of (x, y) tuples of the points
  • outline – The outline of the polygon. Can be a hex value for a color or None for no outline.
outline

The outline of the polygon. Can be a hex value for a color or None for no outline.

sparkline

Various common shapes for use with displayio - Sparkline!

  • Author(s): Kevin Matocha

Implementation Notes

Software and Dependencies:

class adafruit_display_shapes.sparkline.Sparkline(width, height, max_items, y_min=None, y_max=None, x=0, y=0, color=16777215)

A sparkline graph.

Parameters:
  • width – Width of the sparkline graph in pixels
  • height – Height of the sparkline graph in pixels
  • max_items – Maximum number of values housed in the sparkline
  • y_min – Lower range for the y-axis. Set to None for autorange.
  • y_max – Upper range for the y-axis. Set to None for autorange.
  • x – X-position on the screen, in pixels
  • y – Y-position on the screen, in pixels
  • color – Line color, the default value is 0xFFFFFF (WHITE)
add_value(value)

Add a value to the sparkline. :param value: The value to be added to the sparkline

clear_values()

Removes all values from the _spark_list list and removes all lines in the group

update()

Update the drawing of the sparkline.

values()

Returns the values displayed on the sparkline.