|
From: <jd...@us...> - 2008-06-24 18:05:58
|
Revision: 5665
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5665&view=rev
Author: jdh2358
Date: 2008-06-24 11:05:55 -0700 (Tue, 24 Jun 2008)
Log Message:
-----------
removed draft timeout/idle from backend bases; using events instead
Modified Paths:
--------------
trunk/matplotlib/examples/event_handling/idle_and_timeout.py
Modified: trunk/matplotlib/examples/event_handling/idle_and_timeout.py
===================================================================
--- trunk/matplotlib/examples/event_handling/idle_and_timeout.py 2008-06-24 17:46:40 UTC (rev 5664)
+++ trunk/matplotlib/examples/event_handling/idle_and_timeout.py 2008-06-24 18:05:55 UTC (rev 5665)
@@ -1,5 +1,7 @@
"""
Demonstrate/test the idle and timeout API
+
+This is only tested on gtk so far and is a prototype implementation
"""
import numpy as np
import matplotlib.pyplot as plt
@@ -21,24 +23,13 @@
event.canvas.draw()
# test boolean return removal
if on_idle.count==N:
- fig.canvas.mpl_disconnect(on_idle.cid)
+ return False
+ return True
on_idle.cid = None
on_idle.count = 0
-def on_timeout(canvas):
- on_timeout.count +=1
- line2.set_ydata(np.cos(2*np.pi*t*(N-on_idle.count)/float(N)))
- line2.figure.canvas.draw()
- print 'timeout', on_timeout.count
- # test explicit removal
- if on_timeout.count==N:
- return False
- return True
-on_timeout.count = 0
+fig.canvas.mpl_connect('idle_event', on_idle)
-on_idle.cid = fig.canvas.mpl_connect('idle_event', on_idle)
-#fig.canvas.mpl_timeout_add(100, on_timeout)
-
plt.show()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|