ButtonThrower

from panda3d.core import ButtonThrower
class ButtonThrower

Bases: DataNode

Throws Panda Events for button down/up events generated within the data graph.

This is a DataNode which is intended to be parented to the data graph below a device which is generating a sequence of button events, like a MouseAndKeyboard device. It simply takes each button it finds and throws a corresponding event based on the button name via the throw_event() call.

Inheritance diagram

Inheritance diagram of ButtonThrower

__init__(*args, **kwargs)
addParameter()

C++ Interface: add_parameter(const ButtonThrower self, const EventParameter obj)

/**
  • Adds the indicated parameter to the list of parameters that will be passed

  • with each event generated by this ButtonThrower.

*/

addThrowButton()

C++ Interface: add_throw_button(const ButtonThrower self, const ModifierButtons mods, const ButtonHandle button)

/**
  • Adds a new button to the set of buttons that the ButtonThrower explicitly

  • processes.

  • If set_throw_buttons_active is false (which is the default), the

  • ButtonThrower will process all buttons. Otherwise, the ButtonThrower will

  • only process events for the button(s) explicitly named by this function;

  • buttons not on the list will be ignored by this object and passed on

  • downstream to the child node(s) in the data graph. A button that is on

  • the list will be processed by the ButtonThrower and not passed on to the

  • child node(s).

  • The return value is true if the button is added, or false if it was already

  • in the set.

*/

add_parameter()

C++ Interface: add_parameter(const ButtonThrower self, const EventParameter obj)

/**
  • Adds the indicated parameter to the list of parameters that will be passed

  • with each event generated by this ButtonThrower.

*/

add_throw_button()

C++ Interface: add_throw_button(const ButtonThrower self, const ModifierButtons mods, const ButtonHandle button)

/**
  • Adds a new button to the set of buttons that the ButtonThrower explicitly

  • processes.

  • If set_throw_buttons_active is false (which is the default), the

  • ButtonThrower will process all buttons. Otherwise, the ButtonThrower will

  • only process events for the button(s) explicitly named by this function;

  • buttons not on the list will be ignored by this object and passed on

  • downstream to the child node(s) in the data graph. A button that is on

  • the list will be processed by the ButtonThrower and not passed on to the

  • child node(s).

  • The return value is true if the button is added, or false if it was already

  • in the set.

*/

button_down_event
button_repeat_event
button_up_event
candidate_event
clearThrowButtons()

C++ Interface: clear_throw_buttons(const ButtonThrower self)

/**
  • Empties the set of buttons that were added via add_throw_button(). See

  • add_throw_button().

*/

clear_throw_buttons()

C++ Interface: clear_throw_buttons(const ButtonThrower self)

/**
  • Empties the set of buttons that were added via add_throw_button(). See

  • add_throw_button().

*/

getButtonDownEvent()

C++ Interface: get_button_down_event(ButtonThrower self)

/**
  • Returns the button_down_event that has been set on this ButtonThrower. See

  • set_button_down_event().

*/

getButtonRepeatEvent()

C++ Interface: get_button_repeat_event(ButtonThrower self)

/**
  • Returns the button_repeat_event that has been set on this ButtonThrower.

  • See set_button_repeat_event().

*/

getButtonUpEvent()

C++ Interface: get_button_up_event(ButtonThrower self)

/**
  • Returns the button_up_event that has been set on this ButtonThrower. See

  • set_button_up_event().

*/

getCandidateEvent()

C++ Interface: get_candidate_event(ButtonThrower self)

/**
  • Returns the candidate_event that has been set on this ButtonThrower. See

  • set_candidate_event().

*/

getClassType()

C++ Interface: get_class_type()

getKeystrokeEvent()

C++ Interface: get_keystroke_event(ButtonThrower self)

/**
  • Returns the keystroke_event that has been set on this ButtonThrower. See

  • set_keystroke_event().

*/

getModifierButtons()

C++ Interface: get_modifier_buttons(ButtonThrower self)

/**
  • Returns the set of ModifierButtons that the ButtonThrower will consider

  • important enough to prepend the event name with. Normally, this set will

  • be empty, and the ButtonThrower will therefore ignore all ModifierButtons

  • attached to the key events, but if one or more buttons have been added to

  • this set, and those modifier buttons are set on the button event, then the

  • event name will be prepended with the names of the modifier buttons.

*/

getMoveEvent()

C++ Interface: get_move_event(ButtonThrower self)

/**
  • Returns the move_event that has been set on this ButtonThrower. See

  • set_move_event().

*/

getNumParameters()

C++ Interface: get_num_parameters(ButtonThrower self)

/**
  • Returns the number of parameters that have been added to the list of

  • parameters to be passed with each event generated by this ButtonThrower.

*/

getParameter()

C++ Interface: get_parameter(ButtonThrower self, int n)

/**
  • Returns the nth parameter that has been added to the list of parameters

  • passed with each event generated by this ButtonThrower.

*/

getParameters()
getPrefix()

C++ Interface: get_prefix(ButtonThrower self)

/**
  • Returns the prefix that has been set on this ButtonThrower. See

  • set_prefix().

*/

getRawButtonDownEvent()

C++ Interface: get_raw_button_down_event(ButtonThrower self)

/**
  • Returns the raw_button_down_event that has been set on this ButtonThrower.

  • See set_raw_button_down_event().

*/

getRawButtonUpEvent()

C++ Interface: get_raw_button_up_event(ButtonThrower self)

/**
  • Returns the raw_button_up_event that has been set on this ButtonThrower.

  • See set_raw_button_up_event().

*/

getSpecificFlag()

C++ Interface: get_specific_flag(ButtonThrower self)

/**
  • Returns the flag that indicates whether specific events should be

  • generated. See set_specific_flag().

*/

getThrowButtonsActive()

C++ Interface: get_throw_buttons_active(ButtonThrower self)

/**
  • Returns the flag that indicates whether the ButtonThrower will only process

  • events for the explicitly named buttons or not. See

  • set_throw_buttons_active().

*/

getTimeFlag()

C++ Interface: get_time_flag(ButtonThrower self)

/**
  • Returns the flag that indicates whether the time of the button event should

  • be passed as a parameter.

*/

get_button_down_event()

C++ Interface: get_button_down_event(ButtonThrower self)

/**
  • Returns the button_down_event that has been set on this ButtonThrower. See

  • set_button_down_event().

*/

get_button_repeat_event()

C++ Interface: get_button_repeat_event(ButtonThrower self)

/**
  • Returns the button_repeat_event that has been set on this ButtonThrower.

  • See set_button_repeat_event().

*/

get_button_up_event()

C++ Interface: get_button_up_event(ButtonThrower self)

/**
  • Returns the button_up_event that has been set on this ButtonThrower. See

  • set_button_up_event().

*/

get_candidate_event()

C++ Interface: get_candidate_event(ButtonThrower self)

/**
  • Returns the candidate_event that has been set on this ButtonThrower. See

  • set_candidate_event().

*/

get_class_type()

C++ Interface: get_class_type()

get_keystroke_event()

C++ Interface: get_keystroke_event(ButtonThrower self)

/**
  • Returns the keystroke_event that has been set on this ButtonThrower. See

  • set_keystroke_event().

*/

get_modifier_buttons()

C++ Interface: get_modifier_buttons(ButtonThrower self)

/**
  • Returns the set of ModifierButtons that the ButtonThrower will consider

  • important enough to prepend the event name with. Normally, this set will

  • be empty, and the ButtonThrower will therefore ignore all ModifierButtons

  • attached to the key events, but if one or more buttons have been added to

  • this set, and those modifier buttons are set on the button event, then the

  • event name will be prepended with the names of the modifier buttons.

*/

get_move_event()

C++ Interface: get_move_event(ButtonThrower self)

/**
  • Returns the move_event that has been set on this ButtonThrower. See

  • set_move_event().

*/

get_num_parameters()

C++ Interface: get_num_parameters(ButtonThrower self)

/**
  • Returns the number of parameters that have been added to the list of

  • parameters to be passed with each event generated by this ButtonThrower.

*/

get_parameter()

C++ Interface: get_parameter(ButtonThrower self, int n)

/**
  • Returns the nth parameter that has been added to the list of parameters

  • passed with each event generated by this ButtonThrower.

*/

get_parameters()
get_prefix()

C++ Interface: get_prefix(ButtonThrower self)

/**
  • Returns the prefix that has been set on this ButtonThrower. See

  • set_prefix().

*/

get_raw_button_down_event()

C++ Interface: get_raw_button_down_event(ButtonThrower self)

/**
  • Returns the raw_button_down_event that has been set on this ButtonThrower.

  • See set_raw_button_down_event().

*/

get_raw_button_up_event()

C++ Interface: get_raw_button_up_event(ButtonThrower self)

/**
  • Returns the raw_button_up_event that has been set on this ButtonThrower.

  • See set_raw_button_up_event().

*/

get_specific_flag()

C++ Interface: get_specific_flag(ButtonThrower self)

/**
  • Returns the flag that indicates whether specific events should be

  • generated. See set_specific_flag().

*/

get_throw_buttons_active()

C++ Interface: get_throw_buttons_active(ButtonThrower self)

/**
  • Returns the flag that indicates whether the ButtonThrower will only process

  • events for the explicitly named buttons or not. See

  • set_throw_buttons_active().

*/

get_time_flag()

C++ Interface: get_time_flag(ButtonThrower self)

/**
  • Returns the flag that indicates whether the time of the button event should

  • be passed as a parameter.

*/

hasThrowButton()

C++ Interface: has_throw_button(ButtonThrower self, const ButtonHandle button) has_throw_button(ButtonThrower self, const ModifierButtons mods, const ButtonHandle button)

/**
  • Returns true if the indicated button is on the set of buttons that will be

  • processed by the ButtonThrower, false otherwise. See add_throw_button().

*/

/**
  • Returns true if the indicated button, in conjunction with any nonspecified

  • modifier buttons, is on the set of buttons that will be processed by the

  • ButtonThrower. That is to say, returns true if this button was ever passed

  • as the second parameter add_throw_button(), regardless of what the first

  • parameter was.

*/

has_throw_button()

C++ Interface: has_throw_button(ButtonThrower self, const ButtonHandle button) has_throw_button(ButtonThrower self, const ModifierButtons mods, const ButtonHandle button)

/**
  • Returns true if the indicated button is on the set of buttons that will be

  • processed by the ButtonThrower, false otherwise. See add_throw_button().

*/

/**
  • Returns true if the indicated button, in conjunction with any nonspecified

  • modifier buttons, is on the set of buttons that will be processed by the

  • ButtonThrower. That is to say, returns true if this button was ever passed

  • as the second parameter add_throw_button(), regardless of what the first

  • parameter was.

*/

keystroke_event
modifier_buttons
move_event
parameters
prefix
raw_button_down_event
raw_button_up_event
removeThrowButton()

C++ Interface: remove_throw_button(const ButtonThrower self, const ModifierButtons mods, const ButtonHandle button)

/**
  • Removes the indicated button from the set of buttons that the ButtonThrower

  • explicitly processes. See add_throw_button().

  • The return value is true if the button is removed, or false if it was not

  • on the set.

*/

remove_throw_button()

C++ Interface: remove_throw_button(const ButtonThrower self, const ModifierButtons mods, const ButtonHandle button)

/**
  • Removes the indicated button from the set of buttons that the ButtonThrower

  • explicitly processes. See add_throw_button().

  • The return value is true if the button is removed, or false if it was not

  • on the set.

*/

setButtonDownEvent()

C++ Interface: set_button_down_event(const ButtonThrower self, str button_down_event)

/**
  • Specifies the generic event that is generated (if any) each time a key or

  • button is depressed. Unlike the specific events that are unique to each

  • key, this same event name is used for all button events, and the name of

  • the button pressed (possibly with modifier prefixes) will be sent as a

  • parameter.

  • If this string is empty, no event is generated. It is possible to generate

  • both generic events and specific events for the same button.

  • See also set_keystroke_event().

*/

setButtonRepeatEvent()

C++ Interface: set_button_repeat_event(const ButtonThrower self, str button_repeat_event)

/**
  • Specifies the generic event that is generated (if any) repeatedly while a

  • key or button is held down. Unlike the specific events that are unique to

  • each key, this same event name is used for all button events, and the

  • name of the button pressed (possibly with modifier prefixes) will be sent

  • as a parameter.

  • If this string is empty, no event is generated. It is possible to generate

  • both generic events and specific events for the same button.

  • See also set_keystroke_event().

*/

setButtonUpEvent()

C++ Interface: set_button_up_event(const ButtonThrower self, str button_up_event)

/**
  • Specifies the generic event that is generated (if any) each time a key or

  • button is released. See set_button_down_event().

*/

setCandidateEvent()

C++ Interface: set_candidate_event(const ButtonThrower self, str candidate_event)

/**
  • Specifies the event that is generated (if any) for each IME candidate

  • string event received. Events of this nature are received only when the

  • user is entering data using a Microsoft Input Method Editor, typically used

  • for Asian languages such as Japanese or Korean.

  • If you are designing a typing user interface, you should track this event

  • to support the use of the IME. In response to this event, you should

  • display the candidate string in the entry box, with the appropriate

  • sections highlighted, so the user can scroll through the available choices.

  • This event is generated with four parameters, in order: the candidate

  • string, the character at which to start the highlight, the character at

  • which to end the highlight, and the current cursor position.

*/

setKeystrokeEvent()

C++ Interface: set_keystroke_event(const ButtonThrower self, str keystroke_event)

/**
  • Specifies the event that is generated (if any) for each keystroke that is

  • received. A keystroke is different than a button event: it represents the

  • semantic meaning of the sequence of keys that have been pressed. For

  • instance, pressing shift and 4 together will generate the button event

  • “shift-4”, but it will generate the keystroke “$”.

  • If a key is held down, keyrepeat will cause the same keystroke event to be

  • generated repeatedly. This is different from the corresponding down event,

  • which will only be generated once, followed by a number of button repeat

  • events.

  • This event is generated with a single wstring parameter, which is a one-

  • character string that contains the keystroke generated. If this event

  • string is empty, no event is generated.

  • See also set_button_down_event().

*/

setModifierButtons()

C++ Interface: set_modifier_buttons(const ButtonThrower self, const ModifierButtons mods)

/**
  • Changes the set of ModifierButtons that the ButtonThrower will consider

  • important enough to prepend the event name with. Normally, this set will

  • be empty, and the ButtonThrower will therefore ignore all ModifierButtons

  • attached to the key events, but if one or more buttons have been added to

  • this set, then the event name will be prepended with the names of the

  • modifier buttons.

  • It is recommended that you change this setting by first calling

  • get_modifier_buttons(), making adjustments, and passing the new value to

  • set_modifier_buttons(). This way the current state of the modifier buttons

  • will not be lost.

*/

setMoveEvent()

C++ Interface: set_move_event(const ButtonThrower self, str move_event)

/**
  • Specifies the event that is generated (if any) each time the mouse is moved

  • within the window.

*/

setPrefix()

C++ Interface: set_prefix(const ButtonThrower self, str prefix)

/**
  • Sets the prefix which is prepended to all specific event names (that is,

  • event names generated from the button name itself, as opposed to the

  • generic event names like set_button_down_event) thrown by this object.

*/

setRawButtonDownEvent()

C++ Interface: set_raw_button_down_event(const ButtonThrower self, str raw_button_down_event)

/**
  • Like set_button_down_event, but uses the raw, untransformed scan key from

  • the operating system. This uses buttons that are independent of the user’s

  • selected keyboard layout.

*/

setRawButtonUpEvent()

C++ Interface: set_raw_button_up_event(const ButtonThrower self, str raw_button_up_event)

/**
  • Specifies the generic event that is generated (if any) each time a key or

  • button is released. See set_raw_button_down_event().

*/

setSpecificFlag()

C++ Interface: set_specific_flag(const ButtonThrower self, bool specific_flag)

/**
  • Sets the flag that indicates whether specific events (events prefixed by

  • set_prefix, and based on the event name) should be generated at all. This

  • is true by default, but may be disabled if you are only interested in the

  • generic events (for instance, events like set_button_down_event).

*/

setThrowButtonsActive()

C++ Interface: set_throw_buttons_active(const ButtonThrower self, bool flag)

/**
  • Sets the flag that indicates whether the ButtonThrower will only process

  • events for the explicitly named buttons or not. Normally this is false,

  • meaning all buttons are processed; set it true to indicate that only some

  • buttons should be processed. See add_throw_button().

*/

setTimeFlag()

C++ Interface: set_time_flag(const ButtonThrower self, bool time_flag)

/**
  • Sets the flag that indicates whether the time of the button event should be

  • passed as a parameter or not. When this is true, an additional parameter

  • is generated on each event (before all the parameters named by

  • add_parameter) that consists of a single double value, and reflects the

  • time the button was pressed or released, as a value from

  • ClockObject::get_global_clock().

*/

set_button_down_event()

C++ Interface: set_button_down_event(const ButtonThrower self, str button_down_event)

/**
  • Specifies the generic event that is generated (if any) each time a key or

  • button is depressed. Unlike the specific events that are unique to each

  • key, this same event name is used for all button events, and the name of

  • the button pressed (possibly with modifier prefixes) will be sent as a

  • parameter.

  • If this string is empty, no event is generated. It is possible to generate

  • both generic events and specific events for the same button.

  • See also set_keystroke_event().

*/

set_button_repeat_event()

C++ Interface: set_button_repeat_event(const ButtonThrower self, str button_repeat_event)

/**
  • Specifies the generic event that is generated (if any) repeatedly while a

  • key or button is held down. Unlike the specific events that are unique to

  • each key, this same event name is used for all button events, and the

  • name of the button pressed (possibly with modifier prefixes) will be sent

  • as a parameter.

  • If this string is empty, no event is generated. It is possible to generate

  • both generic events and specific events for the same button.

  • See also set_keystroke_event().

*/

set_button_up_event()

C++ Interface: set_button_up_event(const ButtonThrower self, str button_up_event)

/**
  • Specifies the generic event that is generated (if any) each time a key or

  • button is released. See set_button_down_event().

*/

set_candidate_event()

C++ Interface: set_candidate_event(const ButtonThrower self, str candidate_event)

/**
  • Specifies the event that is generated (if any) for each IME candidate

  • string event received. Events of this nature are received only when the

  • user is entering data using a Microsoft Input Method Editor, typically used

  • for Asian languages such as Japanese or Korean.

  • If you are designing a typing user interface, you should track this event

  • to support the use of the IME. In response to this event, you should

  • display the candidate string in the entry box, with the appropriate

  • sections highlighted, so the user can scroll through the available choices.

  • This event is generated with four parameters, in order: the candidate

  • string, the character at which to start the highlight, the character at

  • which to end the highlight, and the current cursor position.

*/

set_keystroke_event()

C++ Interface: set_keystroke_event(const ButtonThrower self, str keystroke_event)

/**
  • Specifies the event that is generated (if any) for each keystroke that is

  • received. A keystroke is different than a button event: it represents the

  • semantic meaning of the sequence of keys that have been pressed. For

  • instance, pressing shift and 4 together will generate the button event

  • “shift-4”, but it will generate the keystroke “$”.

  • If a key is held down, keyrepeat will cause the same keystroke event to be

  • generated repeatedly. This is different from the corresponding down event,

  • which will only be generated once, followed by a number of button repeat

  • events.

  • This event is generated with a single wstring parameter, which is a one-

  • character string that contains the keystroke generated. If this event

  • string is empty, no event is generated.

  • See also set_button_down_event().

*/

set_modifier_buttons()

C++ Interface: set_modifier_buttons(const ButtonThrower self, const ModifierButtons mods)

/**
  • Changes the set of ModifierButtons that the ButtonThrower will consider

  • important enough to prepend the event name with. Normally, this set will

  • be empty, and the ButtonThrower will therefore ignore all ModifierButtons

  • attached to the key events, but if one or more buttons have been added to

  • this set, then the event name will be prepended with the names of the

  • modifier buttons.

  • It is recommended that you change this setting by first calling

  • get_modifier_buttons(), making adjustments, and passing the new value to

  • set_modifier_buttons(). This way the current state of the modifier buttons

  • will not be lost.

*/

set_move_event()

C++ Interface: set_move_event(const ButtonThrower self, str move_event)

/**
  • Specifies the event that is generated (if any) each time the mouse is moved

  • within the window.

*/

set_prefix()

C++ Interface: set_prefix(const ButtonThrower self, str prefix)

/**
  • Sets the prefix which is prepended to all specific event names (that is,

  • event names generated from the button name itself, as opposed to the

  • generic event names like set_button_down_event) thrown by this object.

*/

set_raw_button_down_event()

C++ Interface: set_raw_button_down_event(const ButtonThrower self, str raw_button_down_event)

/**
  • Like set_button_down_event, but uses the raw, untransformed scan key from

  • the operating system. This uses buttons that are independent of the user’s

  • selected keyboard layout.

*/

set_raw_button_up_event()

C++ Interface: set_raw_button_up_event(const ButtonThrower self, str raw_button_up_event)

/**
  • Specifies the generic event that is generated (if any) each time a key or

  • button is released. See set_raw_button_down_event().

*/

set_specific_flag()

C++ Interface: set_specific_flag(const ButtonThrower self, bool specific_flag)

/**
  • Sets the flag that indicates whether specific events (events prefixed by

  • set_prefix, and based on the event name) should be generated at all. This

  • is true by default, but may be disabled if you are only interested in the

  • generic events (for instance, events like set_button_down_event).

*/

set_throw_buttons_active()

C++ Interface: set_throw_buttons_active(const ButtonThrower self, bool flag)

/**
  • Sets the flag that indicates whether the ButtonThrower will only process

  • events for the explicitly named buttons or not. Normally this is false,

  • meaning all buttons are processed; set it true to indicate that only some

  • buttons should be processed. See add_throw_button().

*/

set_time_flag()

C++ Interface: set_time_flag(const ButtonThrower self, bool time_flag)

/**
  • Sets the flag that indicates whether the time of the button event should be

  • passed as a parameter or not. When this is true, an additional parameter

  • is generated on each event (before all the parameters named by

  • add_parameter) that consists of a single double value, and reflects the

  • time the button was pressed or released, as a value from

  • ClockObject::get_global_clock().

*/

specific_flag
throw_buttons_active
time_flag