Closed
Description
Bug report
Bug summary
"""
When calling ginput, usually it is useful to pan and zoom, and for that issue the leftclick button is needed.
You can reassign buttons, but you can't disable them, so if you want to zoom or pan, several points will be part of the data gathered with ginput
"""
Points = figure.ginput(n = 2, timeout = 0, show_clicks = True,
mouse_add = 3, mouse_pop = 4, mouse_stop = 2)
# Paste your code here
# Actually, ginput calls matplotlib.blocking_input.BlockingMouseInput, and the bug is into that class.
# In the mouse_event, it does not assume any wrong input. All buttons must be assigned.
# The fix changes the else by an elif
#
def mouse_event(self):
"""Process a mouse click event."""
event = self.events[-1]
button = event.button
if button == self.button_pop:
self.mouse_event_pop(event)
elif button == self.button_stop:
self.mouse_event_stop(event)
elif self.button_add:
self.mouse_event_add(event)
Actual outcome
With the fix, you can assign wrong button numbers to the leftclick mouse button and get inputs with space, for example
Matplotlib version
- Operating system: Windows 10
- Matplotlib version: 2.2.2
- Matplotlib backend (
print(matplotlib.get_backend())
): Qt5Agg - Python version: 3.6.6
- Jupyter version (if applicable):
- Other libraries: Spyder 3.2.8
conda
Anaconda standard package, after command:
conda update --all