diff --git a/lib/matplotlib/backend_bases.py b/lib/matplotlib/backend_bases.py index 3ef05b0aa12b..c6814e9f3019 100644 --- a/lib/matplotlib/backend_bases.py +++ b/lib/matplotlib/backend_bases.py @@ -1118,12 +1118,14 @@ def _timer_set_single_shot(self): def _on_timer(self): ''' Runs all function that have been registered as callbacks. Functions - can return False if they should not be called any more. If there + can return False (or 0) if they should not be called any more. If there are no callbacks, the timer is automatically stopped. ''' for func, args, kwargs in self.callbacks: ret = func(*args, **kwargs) - if not ret: + # docstring above explains why we use `if ret == False` here, + # instead of `if not ret`. + if ret == False: self.callbacks.remove((func, args, kwargs)) if len(self.callbacks) == 0: