Do not instantiate this object yourself.
You can get a UIEventDevice
object from a hou.UIEvent using hou.UIEvent.device.
For more information see Python state UI events.
Methods ¶
time()
: → double
Returns the time in seconds relative to the event.
Keyboard ¶
The following methods are usable only when a keyboard event has been generated.
isAltKey()
→ bool
Returns True if an Alt/Option key was pressed.
isAutoRepeat()
→ bool
Returns True if the held key was auto-repeating.
isCapsLock()
→ bool
Returns True if the Caps Lock key was pressed.
isCtrlKey()
→ bool
Returns True if the Control key was pressed.
isKeyPad()
→ bool
Returns True if the pressed key was on the number pad.
isShiftKey()
→ bool
Returns True if the a Shift key was pressed.
isArrowDown()
→ bool
Returns True if the Down arrow key was pressed.
isArrowLeft()
→ bool
Returns True if the Left arrow key was pressed.
isArrowRight()
→ bool
Returns True if the Right arrow key was pressed.
isArrowUp()
→ bool
Returns True if the Up arrow key was pressed.
isFunctionKey()
→ bool
Returns True if a function key was pressed.
isKeyPressed()
→ bool
Returns True if any key was pressed.
isKeyDown()
→ bool
Returns True if a key was pressed. This method is used to detect a key down transition with a
with a Python state’s onKeyTransitEvent
method.
isKeyUp()
→ bool
Returns True if a pressed key was released. This method is used to detect a key up transition
with a Python state’s onKeyTransitEvent
method.
keyValue()
→ int
Returns the ascii code for the key being pressed. If modifiers, such as shift
and ctrl
, are pressed
with a key, keyValue
returns only the ascii code of the key, unlike hou.UIEvent.value which
returns the encoded value of the keys combination.
keyString()
→ string
Returns the string
representation of the key being pressed. The return value can also contain modifier symbols, joined with the plus character.
Few examples:
Key(s) pressed |
Return value |
---|---|
|
a |
|
Enter |
|
Tab |
|
Backspace |
|
Esc |
|
Ctrl+Space |
|
Shift+a |
|
Ctrl+Shift+a |
|
Alt+Ctrl+a |
modifierString()
→ string
Returns the string
representation of the modifier keys being pressed.
The return value contains only modifier symbols. The key pressed, if not itself a modifier, is ignored.
Few examples:
Key(s) pressed |
Return value |
---|---|
|
shift |
|
Ctrl+Shift |
|
Alt+Shift |
Mouse ¶
These methods track the mouse states when a mouse event is generated.
See onMouseEvent
method for more.
isLeftButton()
→ bool
Returns True if the left mouse button was pressed.
isMiddleButton()
→ bool
Returns True if the middle mouse button was pressed.
isRightButton()
→ bool
Returns True if the right mouse button was pressed.
isLeftButtonReleased()
→ bool
Returns True if the left mouse button was released.
isMiddleButtonReleased()
→ bool
Returns True if the middle mouse button was released.
isRightButtonReleased()
→ bool
Returns True if the right mouse button was released.
Note
The method returns False if a custom menu is defined by the python state even if the button was released.
mouseX()
→ int
Returns the horizontal mouse position in screen coordinates, counting from the left edge of the view.
mouseY()
→ int
Returns the vertical mouse position in screen coordinates, counting from the bottom edge of the view.
Mouse wheel ¶
Mouse wheel methods can be used when a mouse wheel event is generated.
See onMouseWheelEvent
method for more.
Note
This API does not currently support scroll axes other than vertical.
mouseWheel()
→ int
The result is negative if the wheel was rotated up and positive if it was rotated down.
Different mice will produce different outputs:
-
Mice with “clicky” wheels will generally output a
-1
or+1
event for each click (at least that is the intention). -
Mice with “free spinning” wheels, or touch sensitive surfaces (such as the Apple Magic Mouse), will produce a wider range of values. Small/slow scrolling might trigger a mouse wheel event but this method returns
0
, whereas big/fast scrolling can produce higher numbers for each event, up to around7
, with the numbers increasing as the user “throws” the wheel and decreasing as it slows.
Tablet ¶
These methods track tablet events.
Note
There is no specific event handler for tablet events, onMouseEvent is used instead.
Warning
Some tablet hardware may not support all these methods.
isTablet()
→ bool
Returns False, even if the event was generated by a tablet stylus. Future versions may be able to distinguish tablet and non-tablet events.
tabletAngle()
→ double
Returns tablet stylus angle value.
tabletPressure()
→ double
Returns the tablet pressure value.
tabletRoll()
→ double
Returns the tablet stylus roll value.
tabletTilt()
→ double
Returns the tablet stylus tilt value.