Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commit43a4c2b

Browse files
authored
Merge pull request#16948 from Stefan-Mitic/issue/15139
solution: All subclasses of LocationEvent could be used in cbook.callbacks before being fully initialized - issue 15139
2 parents20da503 +ba42f40 commit43a4c2b

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

‎lib/matplotlib/backend_bases.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1407,14 +1407,17 @@ def __init__(self, name, canvas, x, y, button=None, key=None,
14071407
(*x*, *y*) in figure coords ((0, 0) = bottom left)
14081408
button pressed None, 1, 2, 3, 'up', 'down'
14091409
"""
1410-
LocationEvent.__init__(self,name,canvas,x,y,guiEvent=guiEvent)
14111410
ifbuttoninMouseButton.__members__.values():
14121411
button=MouseButton(button)
14131412
self.button=button
14141413
self.key=key
14151414
self.step=step
14161415
self.dblclick=dblclick
14171416

1417+
# super-init is deferred to the end because it calls back on
1418+
# 'axes_enter_event', which requires a fully initialized event.
1419+
LocationEvent.__init__(self,name,canvas,x,y,guiEvent=guiEvent)
1420+
14181421
def__str__(self):
14191422
return (f"{self.name}: "
14201423
f"xy=({self.x},{self.y}) xydata=({self.xdata},{self.ydata}) "
@@ -1498,8 +1501,9 @@ def on_key(event):
14981501
cid = fig.canvas.mpl_connect('key_press_event', on_key)
14991502
"""
15001503
def__init__(self,name,canvas,key,x=0,y=0,guiEvent=None):
1501-
LocationEvent.__init__(self,name,canvas,x,y,guiEvent=guiEvent)
15021504
self.key=key
1505+
# super-init deferred to the end: callback errors if called before
1506+
LocationEvent.__init__(self,name,canvas,x,y,guiEvent=guiEvent)
15031507

15041508

15051509
def_get_renderer(figure,print_method=None,*,draw_disabled=False):

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp