Internal function.
(self, what, sequence, func, add, needcleanup=1)
| 1486 | self.tk.call('bindtags', self._w, tagList) |
| 1487 | |
| 1488 | def _bind(self, what, sequence, func, add, needcleanup=1): |
| 1489 | """Internal function.""" |
| 1490 | if isinstance(func, str): |
| 1491 | self.tk.call(what + (sequence, func)) |
| 1492 | elif func: |
| 1493 | funcid = self._register(func, self._substitute, |
| 1494 | needcleanup) |
| 1495 | cmd = ('%sif {"[%s %s]" == "break"} break\n' |
| 1496 | % |
| 1497 | (add and '+' or '', |
| 1498 | funcid, self._subst_format_str)) |
| 1499 | self.tk.call(what + (sequence, cmd)) |
| 1500 | return funcid |
| 1501 | elif sequence: |
| 1502 | return self.tk.call(what + (sequence,)) |
| 1503 | else: |
| 1504 | return self.tk.splitlist(self.tk.call(what)) |
| 1505 | |
| 1506 | def bind(self, sequence=None, func=None, add=None): |
| 1507 | """Bind to this widget at event SEQUENCE a call to function FUNC. |