Return a newly created Tcl function. If this function is called, the Python function FUNC will be executed. An optional function SUBST can be given which will be executed before FUNC.
(self, func, subst=None, needcleanup=1)
| 1699 | _nametowidget = nametowidget |
| 1700 | |
| 1701 | def _register(self, func, subst=None, needcleanup=1): |
| 1702 | """Return a newly created Tcl function. If this |
| 1703 | function is called, the Python function FUNC will |
| 1704 | be executed. An optional function SUBST can |
| 1705 | be given which will be executed before FUNC.""" |
| 1706 | f = CallWrapper(func, subst, self).__call__ |
| 1707 | name = repr(id(f)) |
| 1708 | try: |
| 1709 | func = func.__func__ |
| 1710 | except AttributeError: |
| 1711 | pass |
| 1712 | try: |
| 1713 | name = name + func.__name__ |
| 1714 | except AttributeError: |
| 1715 | pass |
| 1716 | self.tk.createcommand(name, f) |
| 1717 | if needcleanup: |
| 1718 | if self._tclCommands is None: |
| 1719 | self._tclCommands = [] |
| 1720 | self._tclCommands.append(name) |
| 1721 | return name |
| 1722 | |
| 1723 | register = _register |
| 1724 |
no test coverage detected