MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / _press

Method _press

lib/matplotlib/widgets.py:2884–2910  ·  view source on GitHub ↗

Button press event handler.

(self, event)

Source from the content-addressed store, hash-verified

2882 self.connect_event('motion_notify_event', self._hover)
2883
2884 def _press(self, event):
2885 """Button press event handler."""
2886 self._set_span_cursor(enabled=True)
2887 if self._interactive and self._selection_artist.get_visible():
2888 self._set_active_handle(event)
2889 else:
2890 self._active_handle = None
2891
2892 if self._active_handle is None or not self._interactive:
2893 # Clear previous rectangle before drawing new rectangle.
2894 self.update()
2895
2896 v = event.xdata if self.direction == 'horizontal' else event.ydata
2897
2898 if self._active_handle is None and not self.ignore_event_outside:
2899 # when the press event outside the span, we initially set the
2900 # visibility to False and extents to (v, v)
2901 # update will be called when setting the extents
2902 self._visible = False
2903 self._set_extents((v, v))
2904 # We need to set the visibility back, so the span selector will be
2905 # drawn when necessary (span width > 0)
2906 self._visible = True
2907 else:
2908 self.set_visible(True)
2909
2910 return False
2911
2912 @property
2913 def direction(self):

Callers

nothing calls this directly

Calls 6

_set_span_cursorMethod · 0.95
_set_active_handleMethod · 0.95
_set_extentsMethod · 0.95
get_visibleMethod · 0.45
updateMethod · 0.45
set_visibleMethod · 0.45

Tested by

no test coverage detected