ButtonThrower
from panda3d.core import ButtonThrower
- class ButtonThrower
Bases:
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 aMouseAndKeyboard
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
- __init__(param0: ButtonThrower)
- __init__(name: str)
- addParameter(obj: EventParameter)
Adds the indicated parameter to the list of parameters that will be passed with each event generated by this
ButtonThrower
.
- addThrowButton(mods: ModifierButtons, button: ButtonHandle) → bool
Adds a new button to the set of buttons that the
ButtonThrower
explicitly processes.If
setThrowButtonsActive()
is false (which is the default), theButtonThrower
will process all buttons. Otherwise, theButtonThrower
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 theButtonThrower
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.
- property button_down_event → string
- Getter
Returns the button_down_event that has been set on this
ButtonThrower
. SeesetButtonDownEvent()
.- Setter
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
setKeystrokeEvent()
.
- property button_repeat_event → string
- Getter
Returns the button_repeat_event that has been set on this
ButtonThrower
. SeesetButtonRepeatEvent()
.- Setter
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
setKeystrokeEvent()
.
- property button_up_event → string
- Getter
Returns the button_up_event that has been set on this
ButtonThrower
. SeesetButtonUpEvent()
.- Setter
Specifies the generic event that is generated (if any) each time a key or button is released. See
setButtonDownEvent()
.
- property candidate_event → string
- Getter
Returns the candidate_event that has been set on this
ButtonThrower
. SeesetCandidateEvent()
.- Setter
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.
- clearThrowButtons()
Empties the set of buttons that were added via
addThrowButton()
. SeeaddThrowButton()
.
- getButtonDownEvent() → str
Returns the button_down_event that has been set on this
ButtonThrower
. SeesetButtonDownEvent()
.
- getButtonRepeatEvent() → str
Returns the button_repeat_event that has been set on this
ButtonThrower
. SeesetButtonRepeatEvent()
.
- getButtonUpEvent() → str
Returns the button_up_event that has been set on this
ButtonThrower
. SeesetButtonUpEvent()
.
- getCandidateEvent() → str
Returns the candidate_event that has been set on this
ButtonThrower
. SeesetCandidateEvent()
.
- static getClassType() → TypeHandle
- getKeystrokeEvent() → str
Returns the keystroke_event that has been set on this
ButtonThrower
. SeesetKeystrokeEvent()
.
- getModifierButtons() → ModifierButtons
Returns the set of
ModifierButtons
that theButtonThrower
will consider important enough to prepend the event name with. Normally, this set will be empty, and theButtonThrower
will therefore ignore allModifierButtons
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() → str
Returns the move_event that has been set on this
ButtonThrower
. SeesetMoveEvent()
.
- getNumParameters() → int
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(n: int) → EventParameter
Returns the nth parameter that has been added to the list of parameters passed with each event generated by this
ButtonThrower
.
- getPrefix() → str
Returns the prefix that has been set on this
ButtonThrower
. SeesetPrefix()
.
- getRawButtonDownEvent() → str
Returns the raw_button_down_event that has been set on this
ButtonThrower
. SeesetRawButtonDownEvent()
.
- getRawButtonUpEvent() → str
Returns the raw_button_up_event that has been set on this
ButtonThrower
. SeesetRawButtonUpEvent()
.
- getSpecificFlag() → bool
Returns the flag that indicates whether specific events should be generated. See
setSpecificFlag()
.
- getThrowButtonsActive() → bool
Returns the flag that indicates whether the
ButtonThrower
will only process events for the explicitly named buttons or not. SeesetThrowButtonsActive()
.
- getTimeFlag() → bool
Returns the flag that indicates whether the time of the button event should be passed as a parameter.
- hasThrowButton(button: ButtonHandle) → bool
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 parameteraddThrowButton()
, regardless of what the first parameter was.
- hasThrowButton(mods: ModifierButtons, button: ButtonHandle) → bool
Returns true if the indicated button is on the set of buttons that will be processed by the
ButtonThrower
, false otherwise. SeeaddThrowButton()
.
- property keystroke_event → string
- Getter
Returns the keystroke_event that has been set on this
ButtonThrower
. SeesetKeystrokeEvent()
.- Setter
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
setButtonDownEvent()
.
- property modifier_buttons → ModifierButtons
- Getter
Returns the set of
ModifierButtons
that theButtonThrower
will consider important enough to prepend the event name with. Normally, this set will be empty, and theButtonThrower
will therefore ignore allModifierButtons
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.- Setter
Changes the set of
ModifierButtons
that theButtonThrower
will consider important enough to prepend the event name with. Normally, this set will be empty, and theButtonThrower
will therefore ignore allModifierButtons
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
getModifierButtons()
, making adjustments, and passing the new value tosetModifierButtons()
. This way the current state of the modifier buttons will not be lost.
- property move_event → string
- Getter
Returns the move_event that has been set on this
ButtonThrower
. SeesetMoveEvent()
.- Setter
Specifies the event that is generated (if any) each time the mouse is moved within the window.
- property parameters → Sequence[EventParameter]
Returns the nth parameter that has been added to the list of parameters passed with each event generated by this
ButtonThrower
.
- property prefix → string
- Getter
Returns the prefix that has been set on this
ButtonThrower
. SeesetPrefix()
.- Setter
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
setButtonDownEvent()
) thrown by this object.
- property raw_button_down_event → string
- Getter
Returns the raw_button_down_event that has been set on this
ButtonThrower
. SeesetRawButtonDownEvent()
.- Setter
Like
setButtonDownEvent()
, but uses the raw, untransformed scan key from the operating system. This uses buttons that are independent of the user’s selected keyboard layout.
- property raw_button_up_event → string
- Getter
Returns the raw_button_up_event that has been set on this
ButtonThrower
. SeesetRawButtonUpEvent()
.- Setter
Specifies the generic event that is generated (if any) each time a key or button is released. See
setRawButtonDownEvent()
.
- removeThrowButton(mods: ModifierButtons, button: ButtonHandle) → bool
Removes the indicated button from the set of buttons that the
ButtonThrower
explicitly processes. SeeaddThrowButton()
.The return value is true if the button is removed, or false if it was not on the set.
- setButtonDownEvent(button_down_event: str)
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
setKeystrokeEvent()
.
- setButtonRepeatEvent(button_repeat_event: str)
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
setKeystrokeEvent()
.
- setButtonUpEvent(button_up_event: str)
Specifies the generic event that is generated (if any) each time a key or button is released. See
setButtonDownEvent()
.
- setCandidateEvent(candidate_event: str)
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(keystroke_event: str)
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
setButtonDownEvent()
.
- setModifierButtons(mods: ModifierButtons)
Changes the set of
ModifierButtons
that theButtonThrower
will consider important enough to prepend the event name with. Normally, this set will be empty, and theButtonThrower
will therefore ignore allModifierButtons
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
getModifierButtons()
, making adjustments, and passing the new value tosetModifierButtons()
. This way the current state of the modifier buttons will not be lost.
- setMoveEvent(move_event: str)
Specifies the event that is generated (if any) each time the mouse is moved within the window.
- setPrefix(prefix: str)
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
setButtonDownEvent()
) thrown by this object.
- setRawButtonDownEvent(raw_button_down_event: str)
Like
setButtonDownEvent()
, 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(raw_button_up_event: str)
Specifies the generic event that is generated (if any) each time a key or button is released. See
setRawButtonDownEvent()
.
- setSpecificFlag(specific_flag: bool)
Sets the flag that indicates whether specific events (events prefixed by
setPrefix()
, 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 likesetButtonDownEvent()
).
- setThrowButtonsActive(flag: bool)
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. SeeaddThrowButton()
.
- setTimeFlag(time_flag: bool)
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
addParameter()
) that consists of a single double value, and reflects the time the button was pressed or released, as a value fromClockObject.getGlobalClock()
.
- property specific_flag → bool
- Getter
Returns the flag that indicates whether specific events should be generated. See
setSpecificFlag()
.- Setter
Sets the flag that indicates whether specific events (events prefixed by
setPrefix()
, 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 likesetButtonDownEvent()
).
- property throw_buttons_active → bool
- Getter
Returns the flag that indicates whether the
ButtonThrower
will only process events for the explicitly named buttons or not. SeesetThrowButtonsActive()
.- Setter
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. SeeaddThrowButton()
.
- property time_flag → bool
- Getter
Returns the flag that indicates whether the time of the button event should be passed as a parameter.
- Setter
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
addParameter()
) that consists of a single double value, and reflects the time the button was pressed or released, as a value fromClockObject.getGlobalClock()
.