Remove *func* from list of callbacks. *args* and *kwargs* are optional and used to distinguish between copies of the same function registered to be called with different arguments. This behavior is deprecated. In the future, ``*args, **kwargs`` won't be con
(self, func, *args, **kwargs)
| 1127 | return func |
| 1128 | |
| 1129 | def remove_callback(self, func, *args, **kwargs): |
| 1130 | """ |
| 1131 | Remove *func* from list of callbacks. |
| 1132 | |
| 1133 | *args* and *kwargs* are optional and used to distinguish between copies |
| 1134 | of the same function registered to be called with different arguments. |
| 1135 | This behavior is deprecated. In the future, ``*args, **kwargs`` won't |
| 1136 | be considered anymore; to keep a specific callback removable by itself, |
| 1137 | pass it to `add_callback` as a `functools.partial` object. |
| 1138 | """ |
| 1139 | if args or kwargs: |
| 1140 | _api.warn_deprecated( |
| 1141 | "3.1", message="In a future version, Timer.remove_callback " |
| 1142 | "will not take *args, **kwargs anymore, but remove all " |
| 1143 | "callbacks where the callable matches; to keep a specific " |
| 1144 | "callback removable by itself, pass it to add_callback as a " |
| 1145 | "functools.partial object.") |
| 1146 | self.callbacks.remove((func, args, kwargs)) |
| 1147 | else: |
| 1148 | funcs = [c[0] for c in self.callbacks] |
| 1149 | if func in funcs: |
| 1150 | self.callbacks.pop(funcs.index(func)) |
| 1151 | |
| 1152 | def _timer_set_interval(self): |
| 1153 | """Used to set interval on underlying timer object.""" |