ButtonNode
from panda3d.core import ButtonNode
- class ButtonNode
Bases:
Bases:
DataNodeThis is the primary interface to on/off button devices associated with a
ClientBase. This creates a node that connects to the named button device, if it exists, and provides hooks to the user to read the state of any of the sequentially numbered buttons associated with that device.It also can associate an arbitrary
ButtonHandlewith each button; when buttons are associated withButtonHandles, this node will put appropriate up and down events on the data graph for each button state change.Inheritance diagram
- __init__(param0: ButtonNode)
- __init__(client: ClientBase, device_name: str)
- __init__(device: InputDevice)
- getButtonMap(index: int) → ButtonHandle
Returns the
ButtonHandlethat was previously associated with the given index number by a call tosetButtonMap(), orButtonHandle.none()if no button was associated.
- getButtonState(index: int) → bool
Returns true if the indicated button (identified by its index number) is currently known to be down, or false if it is up or unknown.
- static getClassType() → TypeHandle
- getNumButtons() → int
Returns the number of buttons known to the
ButtonNode. This includes those buttons whose state has been seen, as well as buttons that have been associated with aButtonHandleeven if their state is unknown. This number may change as more buttons are discovered.
- isButtonKnown(index: int) → bool
Returns true if the state of the indicated button is known, or false if we have never heard anything about this particular button.
- isValid() → bool
Returns true if the
ButtonNodeis valid and connected to a server, false otherwise.
- setButtonMap(index: int, button: ButtonHandle)
Associates the indicated
ButtonHandlewith the button of the indicated index number. When the given button index changes state, a correspondingButtonEventwill be generated with the givenButtonHandle. PassButtonHandle.none()to turn off any association.It is not necessary to call this if you simply want to query the state of the various buttons by index number; this is only necessary in order to generate
ButtonEventswhen the buttons change state.
