Internal class. Stores function to call when some user defined Tcl function is called e.g. after an event occurred.
| 2127 | |
| 2128 | |
| 2129 | class CallWrapper: |
| 2130 | """Internal class. Stores function to call when some user |
| 2131 | defined Tcl function is called e.g. after an event occurred.""" |
| 2132 | |
| 2133 | def __init__(self, func, subst, widget): |
| 2134 | """Store FUNC, SUBST and WIDGET as members.""" |
| 2135 | self.func = func |
| 2136 | self.subst = subst |
| 2137 | self.widget = widget |
| 2138 | |
| 2139 | def __call__(self, *args): |
| 2140 | """Apply first function SUBST to arguments, than FUNC.""" |
| 2141 | try: |
| 2142 | if self.subst: |
| 2143 | args = self.subst(*args) |
| 2144 | return self.func(*args) |
| 2145 | except SystemExit: |
| 2146 | raise |
| 2147 | except: |
| 2148 | self.widget._report_exception() |
| 2149 | |
| 2150 | |
| 2151 | class XView: |