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(*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.

property x0: int

The x-position of the center of the circle.

property y0: int

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(*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 and height.

property fill: Optional[int]

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

property height: int

return: the height of the rectangle in pixels

property outline: Optional[int]

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

property width: int

return: the width of the rectangle in pixels

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 and height.

property fill: Optional[int]

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

property height: int

return: the height of the rounded rectangle in pixels

property outline: Optional[int]

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

property width: int

return: the width of the rounded rectangle in pixels

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(*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.

property fill: Optional[int]

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(*args: Any, **kwargs: Any)

A line.

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.

  • color (int) – The color of the line.

property color: Optional[int]

The line color value. Can be a hex value for a color or None for no line color.

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(*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.

property outline: Optional[int]

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(*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
  • value (float) – The value to be added to the sparkline

  • update (bool) – trigger recreation of primitives

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

clear_values() None

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

update() None

Update the drawing of the sparkline.

values() List[float]

Returns the values displayed on the sparkline.