MCPcopy Index your code
hub / github.com/python/cpython / _bind

Method _bind

Lib/tkinter/__init__.py:1506–1522  ·  view source on GitHub ↗

Internal function.

(self, what, sequence, func, add, needcleanup=1)

Source from the content-addressed store, hash-verified

1504 self.tk.call('bindtags', self._w, tagList)
1505
1506 def _bind(self, what, sequence, func, add, needcleanup=1):
1507 """Internal function."""
1508 if isinstance(func, str):
1509 self.tk.call(what + (sequence, func))
1510 elif func:
1511 funcid = self._register(func, self._substitute,
1512 needcleanup)
1513 cmd = ('%sif {"[%s %s]" == "break"} break\n'
1514 %
1515 (add and '+' or '',
1516 funcid, self._subst_format_str))
1517 self.tk.call(what + (sequence, cmd))
1518 return funcid
1519 elif sequence:
1520 return self.tk.call(what + (sequence,))
1521 else:
1522 return self.tk.splitlist(self.tk.call(what))
1523
1524 def bind(self, sequence=None, func=None, add=None):
1525 """Bind to this widget at event SEQUENCE a call to function FUNC.

Callers 7

bindMethod · 0.95
bind_allMethod · 0.45
bind_classMethod · 0.45
tag_bindMethod · 0.45
tag_bindMethod · 0.45
_tag_bindMethod · 0.45
tag_bindMethod · 0.45

Calls 3

_registerMethod · 0.95
splitlistMethod · 0.80
callMethod · 0.45

Tested by

no test coverage detected