(self, name, canvas, x, y, button=None, key=None,
step=0, dblclick=False, guiEvent=None, *,
buttons=None, modifiers=None)
| 1395 | """ |
| 1396 | |
| 1397 | def __init__(self, name, canvas, x, y, button=None, key=None, |
| 1398 | step=0, dblclick=False, guiEvent=None, *, |
| 1399 | buttons=None, modifiers=None): |
| 1400 | super().__init__( |
| 1401 | name, canvas, x, y, guiEvent=guiEvent, modifiers=modifiers) |
| 1402 | if button in MouseButton.__members__.values(): |
| 1403 | button = MouseButton(button) |
| 1404 | if name == "scroll_event" and button is None: |
| 1405 | if step > 0: |
| 1406 | button = "up" |
| 1407 | elif step < 0: |
| 1408 | button = "down" |
| 1409 | self.button = button |
| 1410 | if name == "motion_notify_event": |
| 1411 | self.buttons = frozenset(buttons if buttons is not None else []) |
| 1412 | else: |
| 1413 | # We don't support 'buttons' for button_press/release_event because |
| 1414 | # toolkits are inconsistent as to whether they report the state |
| 1415 | # before or after the event. |
| 1416 | if buttons: |
| 1417 | raise ValueError( |
| 1418 | "'buttons' is only supported for 'motion_notify_event'") |
| 1419 | self.buttons = None |
| 1420 | self.key = key |
| 1421 | self.step = step |
| 1422 | self.dblclick = dblclick |
| 1423 | |
| 1424 | @classmethod |
| 1425 | def _from_ax_coords(cls, name, ax, xy, *args, **kwargs): |
nothing calls this directly
no test coverage detected