Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 71c1a9e

Browse files
authored
Merge pull request #12281 from meeseeksmachine/auto-backport-of-pr-12269-on-v3.0.0-doc
Backport PR #12269 on branch v3.0.0-doc (Add some param docs to BlockingInput methods)
2 parents fa80e74 + 65de01e commit 71c1a9e

File tree

1 file changed

+52
-6
lines changed

1 file changed

+52
-6
lines changed

lib/matplotlib/blocking_input.py

Lines changed: 52 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -155,14 +155,26 @@ def key_event(self):
155155
self.mouse_event_add(event)
156156

157157
def mouse_event_add(self, event):
158-
"""Process an button-1 event (add a click if inside axes)."""
158+
"""
159+
Process an button-1 event (add a click if inside axes).
160+
161+
Parameters
162+
----------
163+
event : `~.backend_bases.MouseEvent`
164+
"""
159165
if event.inaxes:
160166
self.add_click(event)
161167
else: # If not a valid click, remove from event list.
162168
BlockingInput.pop(self)
163169

164170
def mouse_event_stop(self, event):
165-
"""Process an button-2 event (end blocking input)."""
171+
"""
172+
Process an button-2 event (end blocking input).
173+
174+
Parameters
175+
----------
176+
event : `~.backend_bases.MouseEvent`
177+
"""
166178
# Remove last event just for cleanliness.
167179
BlockingInput.pop(self)
168180
# This will exit even if not in infinite mode. This is consistent with
@@ -171,15 +183,27 @@ def mouse_event_stop(self, event):
171183
self.fig.canvas.stop_event_loop()
172184

173185
def mouse_event_pop(self, event):
174-
"""Process an button-3 event (remove the last click)."""
186+
"""
187+
Process an button-3 event (remove the last click).
188+
189+
Parameters
190+
----------
191+
event : `~.backend_bases.MouseEvent`
192+
"""
175193
# Remove this last event.
176194
BlockingInput.pop(self)
177195
# Now remove any existing clicks if possible.
178196
if self.events:
179197
self.pop(event)
180198

181199
def add_click(self, event):
182-
"""Add the coordinates of an event to the list of clicks."""
200+
"""
201+
Add the coordinates of an event to the list of clicks.
202+
203+
Parameters
204+
----------
205+
event : `~.backend_bases.MouseEvent`
206+
"""
183207
self.clicks.append((event.xdata, event.ydata))
184208
_log.info("input %i: %f, %f",
185209
len(self.clicks), event.xdata, event.ydata)
@@ -192,7 +216,13 @@ def add_click(self, event):
192216
self.fig.canvas.draw()
193217

194218
def pop_click(self, event, index=-1):
195-
"""Remove a click (by default, the last) from the list of clicks."""
219+
"""
220+
Remove a click (by default, the last) from the list of clicks.
221+
222+
Parameters
223+
----------
224+
event : `~.backend_bases.MouseEvent`
225+
"""
196226
self.clicks.pop(index)
197227
if self.show_clicks:
198228
self.marks.pop(index).remove()
@@ -208,6 +238,12 @@ def pop(self, event, index=-1):
208238
BlockingInput.pop(self, index)
209239

210240
def cleanup(self, event=None):
241+
"""
242+
Parameters
243+
----------
244+
event : `~.backend_bases.MouseEvent`, optional
245+
Not used
246+
"""
211247
# Clean the figure.
212248
if self.show_clicks:
213249
for mark in self.marks:
@@ -246,7 +282,13 @@ def pop_click(self, event, index=-1):
246282
self.button3(event)
247283

248284
def button1(self, event):
249-
"""Process an button-1 event (add a label to a contour)."""
285+
"""
286+
Process an button-1 event (add a label to a contour).
287+
288+
Parameters
289+
----------
290+
event : `~.backend_bases.MouseEvent`
291+
"""
250292
# Shorthand
251293
if event.inaxes == self.cs.ax:
252294
self.cs.add_label_near(event.x, event.y, self.inline,
@@ -263,6 +305,10 @@ def button3(self, event):
263305
Unfortunately, if one is doing inline labels, then there is currently
264306
no way to fix the broken contour - once humpty-dumpty is broken, he
265307
can't be put back together. In inline mode, this does nothing.
308+
309+
Parameters
310+
----------
311+
event : `~.backend_bases.MouseEvent`
266312
"""
267313
if self.inline:
268314
pass

0 commit comments

Comments
 (0)