/docs/source/api/iohub/device/mouse.rst

https://gitlab.com/braintech/psychopy-brain · ReStructuredText · 348 lines · 209 code · 139 blank · 0 comment · 0 complexity · 3213274a4dc3e58ff03e3edd1bcc4d1a MD5 · raw file

  1. .. _iohub_mouse:
  2. ########################
  3. The ioHub Mouse Device
  4. ########################
  5. **Platforms:** Windows, macOS, Linux
  6. .. autoclass:: psychopy.iohub.devices.mouse.Mouse
  7. :members: getPosition, setPosition, getEvents, clearEvents, getPositionAndDelta, getScroll, setScroll
  8. :member-order: bysource
  9. Mouse Event Types
  10. #####################
  11. The Mouse device supports the following event types. Device events returned by
  12. getEvents() are automatically converted to either namedtuple or dictionary
  13. objects with the same attributes / keys as the associated event class
  14. attributes.
  15. .. autoclass:: psychopy.iohub.devices.mouse.MouseMoveEvent(object)
  16. .. attribute:: time
  17. time of event, in sec.msec format, using psychopy timebase.
  18. .. attribute:: x_position
  19. x position of the Mouse when the event occurred; in display
  20. coordinate space.
  21. .. attribute:: y_position
  22. y position of the Mouse when the event occurred; in display
  23. coordinate space.
  24. .. attribute:: scroll_x
  25. Horizontal scroll wheel absolute position when the event occurred.
  26. macOS only. Always 0 on other OS's.
  27. .. attribute:: scroll_y
  28. Vertical scroll wheel absolute position when the event occurred.
  29. .. attribute:: modifiers
  30. List of the modifiers that were active when the mouse event occurred,
  31. provided as a list of the modifier constant labels.
  32. .. attribute:: display_id
  33. The id of the display that the mouse was over when the event occurred.
  34. Only supported on Windows at this time. Always 0 on other OS's.
  35. .. attribute:: window_id
  36. Window handle reference that the mouse was over when the event occurred
  37. (window does not need to have focus).
  38. .. attribute:: event_id
  39. The id assigned to the device event. Every event generated by iohub
  40. during an experiment session is assigned a unique id, starting from 0.
  41. .. attribute:: type
  42. The type id for the event. This is used to create DeviceEvent objects
  43. or dictionary representations of an event based on the data from an
  44. event list.
  45. .. autoclass:: psychopy.iohub.devices.mouse.MouseDragEvent(object)
  46. .. attribute:: time
  47. x position of the Mouse when the event occurred; in display
  48. coordinate space.
  49. .. attribute:: x_position
  50. x position of the Mouse when the event occurred; in display
  51. coordinate space.
  52. .. attribute:: button_state
  53. 1 if a mouse button press caused the event, 0 if button was released.
  54. .. attribute:: button_id
  55. Index of the mouse button that caused the event.
  56. MouseConstants.MOUSE_BUTTON_LEFT, MouseConstants.MOUSE_BUTTON_RIGHT
  57. and MouseConstants.MOUSE_BUTTON_MIDDLE are int constants
  58. representing left, right, and middle buttons of the mouse.
  59. .. attribute:: pressed_buttons
  60. All currently pressed button id's logically OR'ed together.
  61. .. attribute:: y_position
  62. y position of the Mouse when the event occurred; in display
  63. coordinate space.
  64. .. attribute:: scroll_x
  65. Horizontal scroll wheel absolute position when the event occurred.
  66. macOS only. Always 0 on other OS's.
  67. .. attribute:: scroll_y
  68. Vertical scroll wheel absolute position when the event occurred.
  69. .. attribute:: modifiers
  70. List of the modifiers that were active when the mouse event occurred,
  71. provided as a list of the modifier constant labels.
  72. .. attribute:: display_id
  73. The id of the display that the mouse was over when the event occurred.
  74. Only supported on Windows at this time. Always 0 on other OS's.
  75. .. attribute:: window_id
  76. Window handle reference that the mouse was over when the event occurred
  77. (window does not need to have focus).
  78. .. attribute:: event_id
  79. The id assigned to the device event. Every event generated by iohub
  80. during an experiment session is assigned a unique id, starting from 0.
  81. .. attribute:: type
  82. The type id for the event. This is used to create DeviceEvent objects
  83. or dictionary representations of an event based on the data from an
  84. event list.
  85. .. autoclass:: psychopy.iohub.devices.mouse.MouseButtonPressEvent(object)
  86. .. attribute:: time
  87. x position of the Mouse when the event occurred; in display
  88. coordinate space.
  89. .. attribute:: x_position
  90. x position of the Mouse when the event occurred; in display
  91. coordinate space.
  92. .. attribute:: button_state
  93. 1 if a mouse button press caused the event, 0 if button was released.
  94. .. attribute:: button_id
  95. Index of the mouse button that caused the event.
  96. MouseConstants.MOUSE_BUTTON_LEFT, MouseConstants.MOUSE_BUTTON_RIGHT
  97. and MouseConstants.MOUSE_BUTTON_MIDDLE are int constants
  98. representing left, right, and middle buttons of the mouse.
  99. .. attribute:: pressed_buttons
  100. All currently pressed button id's logically OR'ed together.
  101. .. attribute:: y_position
  102. y position of the Mouse when the event occurred; in display
  103. coordinate space.
  104. .. attribute:: scroll_x
  105. Horizontal scroll wheel absolute position when the event occurred.
  106. macOS only. Always 0 on other OS's.
  107. .. attribute:: scroll_y
  108. Vertical scroll wheel absolute position when the event occurred.
  109. .. attribute:: modifiers
  110. List of the modifiers that were active when the mouse event occurred,
  111. provided as a list of the modifier constant labels.
  112. .. attribute:: display_id
  113. The id of the display that the mouse was over when the event occurred.
  114. Only supported on Windows at this time. Always 0 on other OS's.
  115. .. attribute:: window_id
  116. Window handle reference that the mouse was over when the event occurred
  117. (window does not need to have focus).
  118. .. attribute:: event_id
  119. The id assigned to the device event. Every event generated by iohub
  120. during an experiment session is assigned a unique id, starting from 0.
  121. .. attribute:: type
  122. The type id for the event. This is used to create DeviceEvent objects
  123. or dictionary representations of an event based on the data from an
  124. event list.
  125. .. autoclass:: psychopy.iohub.devices.mouse.MouseButtonReleaseEvent(object)
  126. .. attribute:: time
  127. x position of the Mouse when the event occurred; in display
  128. coordinate space.
  129. .. attribute:: x_position
  130. x position of the Mouse when the event occurred; in display
  131. coordinate space.
  132. .. attribute:: button_state
  133. 1 if a mouse button press caused the event, 0 if button was released.
  134. .. attribute:: button_id
  135. Index of the mouse button that caused the event.
  136. MouseConstants.MOUSE_BUTTON_LEFT, MouseConstants.MOUSE_BUTTON_RIGHT
  137. and MouseConstants.MOUSE_BUTTON_MIDDLE are int constants
  138. representing left, right, and middle buttons of the mouse.
  139. .. attribute:: pressed_buttons
  140. All currently pressed button id's logically OR'ed together.
  141. .. attribute:: y_position
  142. y position of the Mouse when the event occurred; in display
  143. coordinate space.
  144. .. attribute:: scroll_x
  145. Horizontal scroll wheel absolute position when the event occurred.
  146. macOS only. Always 0 on other OS's.
  147. .. attribute:: scroll_y
  148. Vertical scroll wheel absolute position when the event occurred.
  149. .. attribute:: modifiers
  150. List of the modifiers that were active when the mouse event occurred,
  151. provided as a list of the modifier constant labels.
  152. .. attribute:: display_id
  153. The id of the display that the mouse was over when the event occurred.
  154. Only supported on Windows at this time. Always 0 on other OS's.
  155. .. attribute:: window_id
  156. Window handle reference that the mouse was over when the event occurred
  157. (window does not need to have focus).
  158. .. attribute:: event_id
  159. The id assigned to the device event. Every event generated by iohub
  160. during an experiment session is assigned a unique id, starting from 0.
  161. .. attribute:: type
  162. The type id for the event. This is used to create DeviceEvent objects
  163. or dictionary representations of an event based on the data from an
  164. event list.
  165. .. autoclass:: psychopy.iohub.devices.mouse.MouseScrollEvent(object)
  166. .. attribute:: time
  167. x position of the Mouse when the event occurred; in display
  168. coordinate space.
  169. .. attribute:: x_position
  170. x position of the Mouse when the event occurred; in display
  171. coordinate space.
  172. .. attribute:: button_state
  173. 1 if a mouse button press caused the event, 0 if button was released.
  174. .. attribute:: button_id
  175. Index of the mouse button that caused the event.
  176. MouseConstants.MOUSE_BUTTON_LEFT, MouseConstants.MOUSE_BUTTON_RIGHT
  177. and MouseConstants.MOUSE_BUTTON_MIDDLE are int constants
  178. representing left, right, and middle buttons of the mouse.
  179. .. attribute:: pressed_buttons
  180. All currently pressed button id's logically OR'ed together.
  181. .. attribute:: y_position
  182. y position of the Mouse when the event occurred; in display
  183. coordinate space.
  184. .. attribute:: scroll_x
  185. Horizontal scroll wheel absolute position when the event occurred.
  186. macOS only. Always 0 on other OS's.
  187. .. attribute:: scroll_dx
  188. Horizontal scroll wheel position change when the event occurred.
  189. macOS only. Always 0 on other OS's.
  190. .. attribute:: scroll_y
  191. Vertical scroll wheel absolute position when the event occurred.
  192. .. attribute:: scroll_dy
  193. Vertical scroll wheel position change when the event occurred.
  194. .. attribute:: modifiers
  195. List of the modifiers that were active when the mouse event occurred,
  196. provided as a list of the modifier constant labels.
  197. .. attribute:: display_id
  198. The id of the display that the mouse was over when the event occurred.
  199. Only supported on Windows at this time. Always 0 on other OS's.
  200. .. attribute:: window_id
  201. Window handle reference that the mouse was over when the event occurred
  202. (window does not need to have focus).
  203. .. attribute:: event_id
  204. The id assigned to the device event. Every event generated by iohub
  205. during an experiment session is assigned a unique id, starting from 0.
  206. .. attribute:: type
  207. The type id for the event. This is used to create DeviceEvent objects
  208. or dictionary representations of an event based on the data from an
  209. event list.