CircuitPython Gauge Library
gauge
CircuitPython Gauge
Author: Jose D. Montoya
Implementation Notes
Software and Dependencies:
Adafruit CircuitPython firmware for the supported boards: https://circuitpython.org/downloads
- class gauge.gauge(*args: Any, **kwargs: Any)
scales Class to add different elements to the screen. The origin point set by
x
andy
properties- Parameters:
x (int) – origin x coordinate. Defaults to 0.
y (int) – origin y coordinate. Defaults to 0.
width (int) – plot box width in pixels. Defaults to 100.
length (int) – plot box height in pixels. Defaults to 100.
padding (int) – padding for the scale box in all directions
scale_range (list|None) – x range limits. Defaults to None
background_color (int) – background color in HEX. Defaults to black
0x000000
box_color (int) – allows to choose the box line color. Defaults to white ‘’0xFFFFFF``
ticks (np.array|list) – axis ticks values
tick_lenght (int) – x axes tick height in pixels. Defaults to 28.
tick_color (int) – x axes tick height in pixels. Defaults to 0xFFFFFF.
tick_pos (str|None) – Argument to locate the ticks. Left, center or all
pointer_lenght (int) – width of the bar. Defaults to 10.
scale (int) – scale of the widget
direction (str) – direction of the scale either
horizontal
orVertical
defaults toVertical
- set_threshold(value: int, color: int = 0xFF0000) None
Defines the threshold for the gage to change color :param value: value that will trigger the change :param color: color to change into. Defaults to red
0xFF0000
:return: None
- show_text(text: str, x: int, y: int, anchorpoint: Tuple = (0.5, 0.0)) None
Show desired text in the screen :param str text: text to be displayed :param int x: x coordinate :param int y: y coordinate :param Tuple anchorpoint: Display_text anchor point. Defaults to (0.5, 0.0) :return: None
- static transform(oldrangemin: float | int, oldrangemax: float | int, newrangemin: float | int, newrangemax: float | int, value: float | int) float | int
This function converts the original value into a new defined value in the new range
- Parameters:
- Return int|float:
converted value
- update(new_value)
Function to update gauge value
- Parameters:
new_value – value to be updated
- Returns:
None