KeyEvent
Preview noticeβ
The MatrixOS Python API is in preview and is subject to change; it may contain errors.
Overviewβ
The KeyEvent class represents an event triggered by key input interaction. KeyEvent objects are typically obtained from MatrixOS.KeyPad.Get() and provide direct access to key state, force, timing, and other input properties.
The Python KeyEvent class is implemented in Applications/Python/PikaPython/MatrixOS_KeyEvent.py with type hints in Applications/Python/PikaPython/_MatrixOS_KeyEvent.pyi.
Methodsβ
IDβ
def ID(self) -> int
Gets the unique identifier for this key event.
Returns:
int: The key ID
Stateβ
def State(self) -> int
Gets the current state of the key.
Returns:
int: Key state value
Holdβ
def Hold(self) -> bool
Checks if the key is being held.
Returns:
bool: True if key is held
HoldTimeβ
def HoldTime(self) -> int
Gets the time the key has been held in milliseconds.
Returns:
int: Hold time in milliseconds
Activeβ
def Active(self) -> bool
Checks if the key is currently active (pressed).
Returns:
bool: True if key is active
Forceβ
def Force(self) -> float
Gets the force/pressure applied to the key.
Returns:
float: Force value (0.0 to 1.0)
Valueβ
def Value(self, index: int = 0) -> float
Gets a specific value from the key event.
Parameters:
index(int, optional): Value index (default: 0)
Returns:
float: Value at specified index
__bool__β
def __bool__(self) -> bool
Allows KeyEvent to be used in boolean context.
Returns:
bool: True if event is valid
Comments