21
21
22
22
import matplotlib .artist as martist
23
23
from matplotlib .artist import Artist , allow_rasterization
24
- from matplotlib .backend_bases import FigureCanvasBase , NonGuiException
24
+ from matplotlib .backend_bases import (
25
+ FigureCanvasBase , NonGuiException , MouseButton )
25
26
import matplotlib .cbook as cbook
26
27
import matplotlib .colorbar as cbar
27
28
import matplotlib .image as mimage
@@ -2233,8 +2234,10 @@ def subplots_adjust(self, left=None, bottom=None, right=None, top=None,
2233
2234
ax .set_position (ax .figbox )
2234
2235
self .stale = True
2235
2236
2236
- def ginput (self , n = 1 , timeout = 30 , show_clicks = True , mouse_add = 1 ,
2237
- mouse_pop = 3 , mouse_stop = 2 ):
2237
+ def ginput (self , n = 1 , timeout = 30 , show_clicks = True ,
2238
+ mouse_add = MouseButton .LEFT ,
2239
+ mouse_pop = MouseButton .RIGHT ,
2240
+ mouse_stop = MouseButton .MIDDLE ):
2238
2241
"""
2239
2242
Blocking call to interact with a figure.
2240
2243
@@ -2248,13 +2251,7 @@ def ginput(self, n=1, timeout=30, show_clicks=True, mouse_add=1,
2248
2251
- Stop the interaction and return the points added so far.
2249
2252
2250
2253
The actions are assigned to mouse buttons via the arguments
2251
- *mouse_add*, *mouse_pop* and *mouse_stop*. Mouse buttons are defined
2252
- by the numbers:
2253
-
2254
- - 1: left mouse button
2255
- - 2: middle mouse button
2256
- - 3: right mouse button
2257
- - None: no mouse button
2254
+ *mouse_add*, *mouse_pop* and *mouse_stop*.
2258
2255
2259
2256
Parameters
2260
2257
----------
@@ -2266,11 +2263,11 @@ def ginput(self, n=1, timeout=30, show_clicks=True, mouse_add=1,
2266
2263
will never timeout.
2267
2264
show_clicks : bool, default: True
2268
2265
If True, show a red cross at the location of each click.
2269
- mouse_add : {1, 2, 3, None} , default: 1 (left click)
2266
+ mouse_add : `.MouseButton` or None, default: `.MouseButton.LEFT`
2270
2267
Mouse button used to add points.
2271
- mouse_pop : {1, 2, 3, None} , default: 3 (right click)
2268
+ mouse_pop : `.MouseButton` or None, default: `.MouseButton.RIGHT`
2272
2269
Mouse button used to remove the most recently added point.
2273
- mouse_stop : {1, 2, 3, None} , default: 2 (middle click)
2270
+ mouse_stop : `.MouseButton` or None, default: `.MouseButton.MIDDLE`
2274
2271
Mouse button used to stop input.
2275
2272
2276
2273
Returns
0 commit comments