From fd59a34b3cc762ac09fe415aea08fec8d2870b16 Mon Sep 17 00:00:00 2001 From: Antony Lee Date: Sun, 9 Apr 2017 03:17:06 -0700 Subject: [PATCH] Deprecate FigureCanvasBase.idle_event. The corresponding event had been deprecated since 1.5. --- examples/event_handling/idle_and_timeout.py | 37 --------------------- lib/matplotlib/backend_bases.py | 2 ++ 2 files changed, 2 insertions(+), 37 deletions(-) delete mode 100644 examples/event_handling/idle_and_timeout.py diff --git a/examples/event_handling/idle_and_timeout.py b/examples/event_handling/idle_and_timeout.py deleted file mode 100644 index e89d0b696141..000000000000 --- a/examples/event_handling/idle_and_timeout.py +++ /dev/null @@ -1,37 +0,0 @@ -from __future__ import print_function -""" -Demonstrate/test the idle and timeout API - -WARNING: idle_event is deprecated. Use the animations module instead. - -This is only tested on gtk so far and is a prototype implementation -""" -import numpy as np -import matplotlib.pyplot as plt - -fig, ax = plt.subplots() - -t = np.arange(0.0, 2.0, 0.01) -y1 = np.sin(2*np.pi*t) -y2 = np.cos(2*np.pi*t) -line1, = ax.plot(y1) -line2, = ax.plot(y2) - -N = 100 - - -def on_idle(event): - on_idle.count += 1 - print('idle', on_idle.count) - line1.set_ydata(np.sin(2*np.pi*t*(N - on_idle.count)/float(N))) - event.canvas.draw() - # test boolean return removal - if on_idle.count == N: - return False - return True -on_idle.cid = None -on_idle.count = 0 - -fig.canvas.mpl_connect('idle_event', on_idle) - -plt.show() diff --git a/lib/matplotlib/backend_bases.py b/lib/matplotlib/backend_bases.py index 3ddc4ce6f6c0..01b41e419f11 100644 --- a/lib/matplotlib/backend_bases.py +++ b/lib/matplotlib/backend_bases.py @@ -1354,6 +1354,7 @@ def __init__(self, name, canvas, guiEvent=None): self.guiEvent = guiEvent +@cbook.deprecated("2.1") class IdleEvent(Event): """ An event triggered by the GUI backend when it is idle -- useful @@ -1952,6 +1953,7 @@ def enter_notify_event(self, guiEvent=None, xy=None): event = Event('figure_enter_event', self, guiEvent) self.callbacks.process('figure_enter_event', event) + @cbook.deprecated("2.1") def idle_event(self, guiEvent=None): """Called when GUI is idle.""" s = 'idle_event'