UI4pxNumber
Overview
The UI4pxNumber component displays numbers using a 4-pixel high font on the LED matrix. It's ideal for showing numeric values, scores, timers, and other quantitative information in a compact format.
The UI4pxNumber component is implemented in Applications/Python/PikaPython/MatrixOS_UI4pxNumber.py with type hints in Applications/Python/PikaPython/_MatrixOS_UI4pxNumber.pyi.
Constructor
MatrixOS.UI4pxNumber()
class UI4pxNumber(UIComponent):
def __init__(self) -> None
Creates a new 4-pixel number display component.
Example:
number_display = UI4pxNumber()
Configuration Methods
SetName
def SetName(self, name: str) -> bool
Sets the name/label for the number display.
Parameters:
name(str): Display name or label
Returns:
bool: True if successful
SetColor
def SetColor(self, color: Color) -> bool
Sets the primary color for the number display.
Parameters:
color(Color): Primary display color
Returns:
bool: True if successful
SetAlternativeColor
def SetAlternativeColor(self, alternativeColor: Color) -> bool
Sets an alternative color for special states or highlighting.
Parameters:
alternativeColor(Color): Alternative color
Returns:
bool: True if successful
SetDigits
def SetDigits(self, digits: int) -> bool
Sets the number of digits to display.
Parameters:
digits(int): Number of digits (1-4 typically)
Returns:
bool: True if successful
SetSpacing
def SetSpacing(self, spacing: int) -> bool
Sets the spacing between digits.
Parameters:
spacing(int): Pixel spacing between digits
Returns:
bool: True if successful
Value and Color Functions
SetValueFunc
def SetValueFunc(self, getValueFunc: any) -> bool
Sets a function to dynamically get the current value to display.
Parameters:
getValueFunc(function): Function that returns the current value
Returns:
bool: True if successful
SetColorFunc
def SetColorFunc(self, colorFunc: any) -> bool
Sets a function to dynamically determine the display color.
Parameters:
colorFunc(function): Function that returns the current color
Returns:
bool: True if successful