Internal class. Stores function to call when some user defined Tcl function is called e.g. after an event occurred.
| 1950 | |
| 1951 | |
| 1952 | class CallWrapper: |
| 1953 | """Internal class. Stores function to call when some user |
| 1954 | defined Tcl function is called e.g. after an event occurred.""" |
| 1955 | |
| 1956 | def __init__(self, func, subst, widget): |
| 1957 | """Store FUNC, SUBST and WIDGET as members.""" |
| 1958 | self.func = func |
| 1959 | self.subst = subst |
| 1960 | self.widget = widget |
| 1961 | |
| 1962 | def __call__(self, *args): |
| 1963 | """Apply first function SUBST to arguments, than FUNC.""" |
| 1964 | try: |
| 1965 | if self.subst: |
| 1966 | args = self.subst(*args) |
| 1967 | return self.func(*args) |
| 1968 | except SystemExit: |
| 1969 | raise |
| 1970 | except: |
| 1971 | self.widget._report_exception() |
| 1972 | |
| 1973 | |
| 1974 | class XView: |