A mouse event ('button_press_event', 'button_release_event', \ 'scroll_event', 'motion_notify_event'). A MouseEvent has a number of special attributes in addition to those defined by the parent `Event` and `LocationEvent` classes. Attributes ---------- button : None or `Mo
| 1321 | |
| 1322 | |
| 1323 | class MouseEvent(LocationEvent): |
| 1324 | """ |
| 1325 | A mouse event ('button_press_event', 'button_release_event', \ |
| 1326 | 'scroll_event', 'motion_notify_event'). |
| 1327 | |
| 1328 | A MouseEvent has a number of special attributes in addition to those |
| 1329 | defined by the parent `Event` and `LocationEvent` classes. |
| 1330 | |
| 1331 | Attributes |
| 1332 | ---------- |
| 1333 | button : None or `MouseButton` or {'up', 'down'} |
| 1334 | The button pressed. 'up' and 'down' are used for scroll events. |
| 1335 | |
| 1336 | Note that LEFT and RIGHT actually refer to the "primary" and |
| 1337 | "secondary" buttons, i.e. if the user inverts their left and right |
| 1338 | buttons ("left-handed setting") then the LEFT button will be the one |
| 1339 | physically on the right. |
| 1340 | |
| 1341 | If this is unset, *name* is "scroll_event", and *step* is nonzero, then |
| 1342 | this will be set to "up" or "down" depending on the sign of *step*. |
| 1343 | |
| 1344 | buttons : None or frozenset |
| 1345 | For 'motion_notify_event', the mouse buttons currently being pressed |
| 1346 | (a set of zero or more MouseButtons); |
| 1347 | for other events, None. |
| 1348 | |
| 1349 | .. note:: |
| 1350 | For 'motion_notify_event', this attribute is more accurate than |
| 1351 | the ``button`` (singular) attribute, which is obtained from the last |
| 1352 | 'button_press_event' or 'button_release_event' that occurred within |
| 1353 | the canvas (and thus 1. be wrong if the last change in mouse state |
| 1354 | occurred when the canvas did not have focus, and 2. cannot report |
| 1355 | when multiple buttons are pressed). |
| 1356 | |
| 1357 | This attribute is not set for 'button_press_event' and |
| 1358 | 'button_release_event' because GUI toolkits are inconsistent as to |
| 1359 | whether they report the button state *before* or *after* the |
| 1360 | press/release occurred. |
| 1361 | |
| 1362 | .. warning:: |
| 1363 | On macOS, the Tk backends only report a single button even if |
| 1364 | multiple buttons are pressed. |
| 1365 | |
| 1366 | key : None or str |
| 1367 | The key pressed when the mouse event triggered, e.g. 'shift'. |
| 1368 | See `KeyEvent`. |
| 1369 | |
| 1370 | .. warning:: |
| 1371 | This key is currently obtained from the last 'key_press_event' or |
| 1372 | 'key_release_event' that occurred within the canvas. Thus, if the |
| 1373 | last change of keyboard state occurred while the canvas did not have |
| 1374 | focus, this attribute will be wrong. On the other hand, the |
| 1375 | ``modifiers`` attribute should always be correct, but it can only |
| 1376 | report on modifier keys. |
| 1377 | |
| 1378 | step : float |
| 1379 | The number of scroll steps (positive for 'up', negative for 'down'). |
| 1380 | This applies only to 'scroll_event' and defaults to 0 otherwise. |
no outgoing calls
searching dependent graphs…