Simple Dial Library

simple_dial

A simple dial gauge widget for displaying graphical information. modified from dial gauge by Kevin Matocha

  • Author(s): Kevin Matocha, Jose David Montoya

Implementation Notes

Software and Dependencies:

class circuitpython_simple_dial.simple_dial.Dial(*args: Any, **kwargs: Any)

A dial widget. The origin is set using x and y.

Parameters:
  • x (int) – pixel position

  • y (int) – pixel position

  • width (int) – requested width, in pixels

  • height (int) – requested height, in pixels

  • padding (int) – keep out padding amount around the border, in pixels, default is 12

  • tick_color (int) – tick line color (24-bit hex value). Defaults to 0xFFFFFF

  • major_ticks (int) – number of major ticks. Defaults to 5

  • major_tick_stroke (int) – major tick line stroke width, in pixels. Defaults to 3

  • major_tick_length (int) – major tick length, in pixels. Default to 10

  • major_tick_labels (str) – array of strings for the major tick labels, default is (“0”, “25”, “50”, “75”, “100”)

  • tick_label_scale (float) – the scaling of the tick labels. Defaults to 1.0

  • tick_label_font (Font) – font to be used for major tick labels, default is terminalio.FONT

  • tick_label_color (int) – color for the major tick labels. Defaults to 0xFFFFFF

  • angle_tick_labels (Boolean) – set True to rotate the major tick labels to match the tick angle. Defaults to True

  • minor_ticks (int) – number of minor ticks (per major tick). Defaults to 5

  • minor_tick_stroke (int) – minor tick line stroke width, in pixels. Defaults to 1

  • minor_tick_length (int) – minor tick length, in pixels. Defaults to 5

  • background_color (int) – background color (RGB tuple or 24-bit hex value), set None for transparent, default is None

draw_ticks(tick_count, tick_stroke, tick_length)

Helper function for drawing ticks on the dial widget. Can be used to customize the dial face.

Parameters:
  • tick_count (int) – number of ticks to be drawn

  • tick_stroke (int) – the pixel width of the line used to draw the tick

draw_labels(positions, labels)

Helper function for drawing text labels on the dial widget. Can be used to customize the dial face.

dial_needle

A simple dial gauge widget for displaying graphical information. modified from dial gauge by Kevin Matocha

  • Author(s): Kevin Matocha, Jose David Montoya

Implementation Notes

Software and Dependencies:

class circuitpython_simple_dial.dial_needle.needle(dial_object, needle_width=3, needle_pad=10, needle_full=False, needle_color=8912896, limit_rotation=True, value=None, min_value=0.0, max_value=100.0)

Class needle

Parameters:
  • dial_object – dial object for the needle to be drawn on

  • needle_width (int) – needle width. Default to 3

  • needle_color (int) – color value for the needle. Defaults to 0x880000

  • needle_pad (int) – space between the dial circle and the needle. Defaults to 10

  • limit_rotation (bool) – Set True to limit needle rotation to between the min_value and max_value, set to False for unlimited rotation. Defaults to True

  • needle_full (bool) – Set to True to show a full needle. Defaults to False

  • min_value (float) – the minimum value displayed on the dial. Defaults to 0.0

  • max_value (float) – the maximum value displayed the dial. Defaults to 100.0

  • value (float) – the value to display (if None, defaults to min_value)

property value

The dial’s value.