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

Method _update

lib/matplotlib/widgets.py:578–599  ·  view source on GitHub ↗

Update the slider position.

(self, event)

Source from the content-addressed store, hash-verified

576
577 @_call_with_reparented_event
578 def _update(self, event):
579 """Update the slider position."""
580 if self.ignore(event) or event.button != 1:
581 return
582
583 if event.name == 'button_press_event' and self.ax.contains(event)[0]:
584 self.drag_active = True
585 event.canvas.grab_mouse(self.ax)
586
587 if not self.drag_active:
588 return
589
590 if (event.name == 'button_release_event'
591 or event.name == 'button_press_event' and not self.ax.contains(event)[0]):
592 self.drag_active = False
593 event.canvas.release_mouse(self.ax)
594 return
595
596 val = self._value_in_bounds(
597 event.xdata if self.orientation == 'horizontal' else event.ydata)
598 if val not in [None, self.val]:
599 self.set_val(val)
600
601 def _format(self, val):
602 """Pretty-print *val*."""

Callers

nothing calls this directly

Calls 6

_value_in_boundsMethod · 0.95
set_valMethod · 0.95
grab_mouseMethod · 0.80
release_mouseMethod · 0.80
ignoreMethod · 0.45
containsMethod · 0.45

Tested by

no test coverage detected