[issue31485] Tkinter widget.unbind(sequence, funcid) unbind all bindings
Giovanni Lombardo
report at bugs.python.org
Sun Jan 5 13:22:42 EST 2020
Giovanni Lombardo <g.lombardo at protonmail.com> added the comment:
I propose the below fix:
```
def unbind(self, sequence, funcid=None):
"""Unbind for this widget for event SEQUENCE the
function identified with FUNCID."""
bound = ''
if funcid:
self.deletecommand(funcid)
funcs = self.tk.call('bind', self._w, sequence, None).split('\n')
bound = '\n'.join([f for f in funcs if not f.startswith('if {{"[{0}'.format(funcid))])
self.tk.call('bind', self._w, sequence, bound)
```
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue31485>
_______________________________________
More information about the Python-bugs-list
mailing list