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

Skip to content

Commit bed1555

Browse files
committed
Made mpl_disconnect() effective on a per binding basis rather than
disconnecting all bindings in one call. svn path=/trunk/matplotlib/; revision=729
1 parent e474977 commit bed1555

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

lib/matplotlib/backends/backend_tkagg.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,8 @@ def the_binding(e):
170170
e.button = e.num
171171
return handler(e.widget, e)
172172
for name in tkname[eventname]:
173-
self._tkcanvas.bind(name, the_binding, add=True)
174-
return (eventname, the_binding)
173+
tk_binding_id = self._tkcanvas.bind(name, the_binding, add=True)
174+
return (eventname, tk_binding_id)
175175

176176
def key_press(self, event):
177177
val = event.keysym_num
@@ -236,8 +236,8 @@ def wrapper(widget, event):
236236
return self.connect(s, wrapper)
237237

238238
def mpl_disconnect(self, cid):
239-
eventname, the_binding = cid
240-
self._tkcanvas.unbind(eventname) #, the_binding)
239+
eventname, tk_binding_id = cid
240+
self._tkcanvas.unbind(None,funcid=tk_binding_id) #, the_binding)
241241
return None
242242

243243
class FigureManagerTkAgg(FigureManagerBase):

0 commit comments

Comments
 (0)