panda3d.core.ButtonMap

from panda3d.core import ButtonMap
class ButtonMap

Bases: TypedReferenceCount

This class represents a map containing all of the buttons of a (keyboard) device, though it can also be used as a generic mapping between ButtonHandles. It maps an underlying ‘raw’ button to a ‘virtual’ button, which may optionally be associated with an appropriate platform-specific name for the button.

Inheritance diagram

Inheritance diagram of ButtonMap

__init__() → None
__init__(param0: ButtonMap) → None
static getClassType() → TypeHandle
Return type

TypeHandle

getMappedButton(raw: ButtonHandle) → ButtonHandle

Returns the button that the given button is mapped to, or ButtonHandle.none() if this map does not specify a mapped button for the given raw button.

Return type

ButtonHandle

getMappedButton(i: size_t) → ButtonHandle

Returns the nth mapped button, meaning the button that the nth raw button is mapped to.

Return type

ButtonHandle

getMappedButton(raw_name: str) → ButtonHandle

Returns the button that the given button is mapped to, or ButtonHandle.none() if this map does not specify a mapped button for the given raw button.

Return type

ButtonHandle

getMappedButtonLabel(raw: ButtonHandle) → str

If the button map specifies a special name for the button (eg. if the operating system or keyboard device has a localized name describing the key), returns it, or the empty string otherwise.

Note that this is not the same as getMappedButton().get_name(), which returns the name of the Panda event associated with the button.

getMappedButtonLabel(i: size_t) → str

Returns the label associated with the nth mapped button, meaning the button that the nth raw button is mapped to.

getMappedButtonLabel(raw_name: str) → str

If the button map specifies a special name for the button (eg. if the operating system or keyboard device has a localized name describing the key), returns it, or the empty string otherwise.

Note that this is not the same as getMappedButton().get_name(), which returns the name of the Panda event associated with the button.

getNumButtons() → size_t

Returns the number of buttons that this button mapping specifies.

Return type

size_t

getRawButton(i: size_t) → ButtonHandle

Returns the underlying raw button associated with the nth button.

Return type

ButtonHandle

output(out: ostream) → None
write(out: ostream, indent_level: int) → None