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

Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions lib/matplotlib/backend_bases.py
Original file line number Diff line number Diff line change
Expand Up @@ -1420,14 +1420,17 @@ def __init__(self, name, canvas, x, y, button=None, key=None,
(*x*, *y*) in figure coords ((0, 0) = bottom left)
button pressed None, 1, 2, 3, 'up', 'down'
"""
LocationEvent.__init__(self, name, canvas, x, y, guiEvent=guiEvent)
if button in MouseButton.__members__.values():
button = MouseButton(button)
self.button = button
self.key = key
self.step = step
self.dblclick = dblclick

# super-init is deferred to the end because it calls back on
# 'axes_enter_event', which requires a fully initialized event.
LocationEvent.__init__(self, name, canvas, x, y, guiEvent=guiEvent)

def __str__(self):
return (f"{self.name}: "
f"xy=({self.x}, {self.y}) xydata=({self.xdata}, {self.ydata}) "
Expand Down Expand Up @@ -1512,8 +1515,9 @@ def on_key(event):
cid = fig.canvas.mpl_connect('key_press_event', on_key)
"""
def __init__(self, name, canvas, key, x=0, y=0, guiEvent=None):
LocationEvent.__init__(self, name, canvas, x, y, guiEvent=guiEvent)
self.key = key
# super-init deferred to the end: callback errors if called before
LocationEvent.__init__(self, name, canvas, x, y, guiEvent=guiEvent)


def _get_renderer(figure, print_method, *, draw_disabled=False):
Expand Down