diff --git a/lib/matplotlib/blocking_input.py b/lib/matplotlib/blocking_input.py index d5e9257c10fe..1064c37bb81c 100644 --- a/lib/matplotlib/blocking_input.py +++ b/lib/matplotlib/blocking_input.py @@ -155,14 +155,26 @@ def key_event(self): self.mouse_event_add(event) def mouse_event_add(self, event): - """Process an button-1 event (add a click if inside axes).""" + """ + Process an button-1 event (add a click if inside axes). + + Parameters + ---------- + event : `~.backend_bases.MouseEvent` + """ if event.inaxes: self.add_click(event) else: # If not a valid click, remove from event list. BlockingInput.pop(self) def mouse_event_stop(self, event): - """Process an button-2 event (end blocking input).""" + """ + Process an button-2 event (end blocking input). + + Parameters + ---------- + event : `~.backend_bases.MouseEvent` + """ # Remove last event just for cleanliness. BlockingInput.pop(self) # This will exit even if not in infinite mode. This is consistent with @@ -171,7 +183,13 @@ def mouse_event_stop(self, event): self.fig.canvas.stop_event_loop() def mouse_event_pop(self, event): - """Process an button-3 event (remove the last click).""" + """ + Process an button-3 event (remove the last click). + + Parameters + ---------- + event : `~.backend_bases.MouseEvent` + """ # Remove this last event. BlockingInput.pop(self) # Now remove any existing clicks if possible. @@ -179,7 +197,13 @@ def mouse_event_pop(self, event): self.pop(event) def add_click(self, event): - """Add the coordinates of an event to the list of clicks.""" + """ + Add the coordinates of an event to the list of clicks. + + Parameters + ---------- + event : `~.backend_bases.MouseEvent` + """ self.clicks.append((event.xdata, event.ydata)) _log.info("input %i: %f, %f", len(self.clicks), event.xdata, event.ydata) @@ -192,7 +216,13 @@ def add_click(self, event): self.fig.canvas.draw() def pop_click(self, event, index=-1): - """Remove a click (by default, the last) from the list of clicks.""" + """ + Remove a click (by default, the last) from the list of clicks. + + Parameters + ---------- + event : `~.backend_bases.MouseEvent` + """ self.clicks.pop(index) if self.show_clicks: self.marks.pop(index).remove() @@ -208,6 +238,12 @@ def pop(self, event, index=-1): BlockingInput.pop(self, index) def cleanup(self, event=None): + """ + Parameters + ---------- + event : `~.backend_bases.MouseEvent`, optional + Not used + """ # Clean the figure. if self.show_clicks: for mark in self.marks: @@ -246,7 +282,13 @@ def pop_click(self, event, index=-1): self.button3(event) def button1(self, event): - """Process an button-1 event (add a label to a contour).""" + """ + Process an button-1 event (add a label to a contour). + + Parameters + ---------- + event : `~.backend_bases.MouseEvent` + """ # Shorthand if event.inaxes == self.cs.ax: self.cs.add_label_near(event.x, event.y, self.inline, @@ -263,6 +305,10 @@ def button3(self, event): Unfortunately, if one is doing inline labels, then there is currently no way to fix the broken contour - once humpty-dumpty is broken, he can't be put back together. In inline mode, this does nothing. + + Parameters + ---------- + event : `~.backend_bases.MouseEvent` """ if self.inline: pass