ButtonNode

from panda3d.core import ButtonNode
class ButtonNode

Bases: DataNode

This 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 ButtonHandle with each button; when buttons are associated with ButtonHandles, this node will put appropriate up and down events on the data graph for each button state change.

Inheritance diagram

Inheritance diagram of ButtonNode

__init__(*args, **kwargs)
getButtonMap()

C++ Interface: get_button_map(ButtonNode self, int index)

/**
  • Returns the ButtonHandle that was previously associated with the given

  • index number by a call to set_button_map(), or ButtonHandle::none() if no

  • button was associated.

*/

getButtonState()

C++ Interface: get_button_state(ButtonNode self, int index)

/**
  • 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.

*/

getClassType()

C++ Interface: get_class_type()

getNumButtons()

C++ Interface: get_num_buttons(ButtonNode self)

/**
  • 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 a ButtonHandle even if their state is unknown. This number

  • may change as more buttons are discovered.

*/

get_button_map()

C++ Interface: get_button_map(ButtonNode self, int index)

/**
  • Returns the ButtonHandle that was previously associated with the given

  • index number by a call to set_button_map(), or ButtonHandle::none() if no

  • button was associated.

*/

get_button_state()

C++ Interface: get_button_state(ButtonNode self, int index)

/**
  • 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.

*/

get_class_type()

C++ Interface: get_class_type()

get_num_buttons()

C++ Interface: get_num_buttons(ButtonNode self)

/**
  • 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 a ButtonHandle even if their state is unknown. This number

  • may change as more buttons are discovered.

*/

isButtonKnown()

C++ Interface: is_button_known(ButtonNode self, int index)

/**
  • Returns true if the state of the indicated button is known, or false if we

  • have never heard anything about this particular button.

*/

isValid()

C++ Interface: is_valid(ButtonNode self)

/**
  • Returns true if the ButtonNode is valid and connected to a server, false

  • otherwise.

*/

is_button_known()

C++ Interface: is_button_known(ButtonNode self, int index)

/**
  • Returns true if the state of the indicated button is known, or false if we

  • have never heard anything about this particular button.

*/

is_valid()

C++ Interface: is_valid(ButtonNode self)

/**
  • Returns true if the ButtonNode is valid and connected to a server, false

  • otherwise.

*/

setButtonMap()

C++ Interface: set_button_map(const ButtonNode self, int index, ButtonHandle button)

/**
  • Associates the indicated ButtonHandle with the button of the indicated

  • index number. When the given button index changes state, a corresponding

  • ButtonEvent will be generated with the given ButtonHandle. Pass

  • ButtonHandle::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 ButtonEvents when the buttons change state.

*/

set_button_map()

C++ Interface: set_button_map(const ButtonNode self, int index, ButtonHandle button)

/**
  • Associates the indicated ButtonHandle with the button of the indicated

  • index number. When the given button index changes state, a corresponding

  • ButtonEvent will be generated with the given ButtonHandle. Pass

  • ButtonHandle::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 ButtonEvents when the buttons change state.

*/