Create a new backend-specific subclass of `.TimerBase`. This is useful for getting periodic events through the backend's native event loop. Implemented only for backends with GUIs. Parameters ---------- interval : int Timer interval in
(self, interval=None, callbacks=None)
| 2403 | _timer_cls = TimerBase |
| 2404 | |
| 2405 | def new_timer(self, interval=None, callbacks=None): |
| 2406 | """ |
| 2407 | Create a new backend-specific subclass of `.TimerBase`. |
| 2408 | |
| 2409 | This is useful for getting periodic events through the backend's native |
| 2410 | event loop. Implemented only for backends with GUIs. |
| 2411 | |
| 2412 | Parameters |
| 2413 | ---------- |
| 2414 | interval : int |
| 2415 | Timer interval in milliseconds. |
| 2416 | |
| 2417 | callbacks : list[tuple[callable, tuple, dict]] |
| 2418 | Sequence of (func, args, kwargs) where ``func(*args, **kwargs)`` |
| 2419 | will be executed by the timer every *interval*. |
| 2420 | |
| 2421 | Callbacks which return ``False`` or ``0`` will be removed from the |
| 2422 | timer. |
| 2423 | |
| 2424 | Examples |
| 2425 | -------- |
| 2426 | >>> timer = fig.canvas.new_timer(callbacks=[(f1, (1,), {'a': 3})]) |
| 2427 | """ |
| 2428 | return self._timer_cls(interval=interval, callbacks=callbacks) |
| 2429 | |
| 2430 | def flush_events(self): |
| 2431 | """ |
no outgoing calls
no test coverage detected