Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 357fd71

Browse filesBrowse files
dstansbyMeeseeksDev[bot]
authored andcommitted
Backport PR #12269: Add some param docs to BlockingInput methods
1 parent 4ee0cf0 commit 357fd71
Copy full SHA for 357fd71

File tree

Expand file treeCollapse file tree

1 file changed

+52
-6
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+52
-6
lines changed

‎lib/matplotlib/blocking_input.py

Copy file name to clipboardExpand all lines: lib/matplotlib/blocking_input.py
+52-6Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.