ButtonHandle¶
from acron.core import ButtonHandle
- class ButtonHandle¶
Bases:
A ButtonHandle represents a single button from any device, including keyboard buttons and mouse buttons (but see
KeyboardButtonandMouseButton).Inheritance diagram
digraph inheritance23e2a35996 { bgcolor=transparent; rankdir=BT; size="8.0, 12.0"; "ButtonHandle" [URL="acron.core.ButtonHandle.html#acron.core.ButtonHandle",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=11,height=0.25,shape=box,style="",target="_top",tooltip="/**"]; "DTOOL_SUPER_BASE" -> "ButtonHandle" [arrowsize=0.75,style=""]; "DTOOL_SUPER_BASE" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=11,height=0.25,shape=box,style=""]; }- __eq__()¶
- __ge__()¶
- __gt__()¶
- __init__()¶
The default constructor must do nothing, because we can’t guarantee ordering of static initializers. If the constructor tried to initialize its value, it might happen after the value had already been set previously by another static initializer!
Constructs a
ButtonHandlewith the corresponding index number, which may have been returned by an earlier call toButtonHandle.get_index().Constructs a
ButtonHandlewith the corresponding name, which is looked up in theButtonRegistry. This exists for the purpose of being able to automatically coerce a string into aButtonHandle; for most purposes, you should use either the static KeyboardButton/MouseButton getters or ButtonRegistry::register_button().
- __le__()¶
- __lt__()¶
- __ne__()¶
- property alias → ButtonHandle¶
Returns the alias (alternate name) associated with the button, if any, or
ButtonHandle.none()if the button has no alias.Each button is allowed to have one alias, and multiple different buttons can refer to the same alias. The alias should be the more general name for the button, for instance, shift is an alias for lshift, but not vice-versa.
- property ascii_equivalent → char¶
Returns the character code associated with the button, or ‘0’ if no ASCII code was associated.
- compare_to()¶
Sorts
ButtonHandlesarbitrarily (according to <, >, etc.). Returns a number less than 0 if this type sorts before the other one, greater than zero if it sorts after, 0 if they are equivalent.
- get_alias()¶
Returns the alias (alternate name) associated with the button, if any, or
ButtonHandle.none()if the button has no alias.Each button is allowed to have one alias, and multiple different buttons can refer to the same alias. The alias should be the more general name for the button, for instance, shift is an alias for lshift, but not vice-versa.
- get_ascii_equivalent()¶
Returns the character code associated with the button, or ‘0’ if no ASCII code was associated.
- static get_class_type()¶
- get_hash()¶
Returns a hash code suitable for phash_map.
- get_index()¶
Returns the integer index associated with this
ButtonHandle. Each differentButtonHandlewill have a different index. However, you probably shouldn’t be using this method; you should just treat theButtonHandlesas opaque classes. This is provided for the convenience of non-C++ scripting languages to build a hashtable ofButtonHandles.
- get_name()¶
Returns the name of the button.
- has_ascii_equivalent()¶
Returns true if the button was created with an ASCII equivalent code (e.g. for a standard keyboard button).
- property index → int¶
Returns the integer index associated with this
ButtonHandle. Each differentButtonHandlewill have a different index. However, you probably shouldn’t be using this method; you should just treat theButtonHandlesas opaque classes. This is provided for the convenience of non-C++ scripting languages to build a hashtable ofButtonHandles.
- matches()¶
Returns true if this
ButtonHandleis the same as the other one, or if the other one is an alias for this one. (Does not return true if this button is an alias for the other one, however.)This is a more general comparison than operator ==.
- static none()¶
- output()¶