Internal function.
(self, what, sequence, func, add, needcleanup=1)
| 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. |