Revision: 5598
          http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5598&view=rev
Author:   jdh2358
Date:     2008-06-19 12:13:15 -0700 (Thu, 19 Jun 2008)

Log Message:
-----------
replaced gtk timeout example

Added Paths:
-----------
    trunk/matplotlib/examples/animation/gtk_timeout.py

Removed Paths:
-------------
    trunk/matplotlib/examples/animation/dynamic_demo.py

Deleted: trunk/matplotlib/examples/animation/dynamic_demo.py
===================================================================
--- trunk/matplotlib/examples/animation/dynamic_demo.py 2008-06-19 17:23:34 UTC 
(rev 5597)
+++ trunk/matplotlib/examples/animation/dynamic_demo.py 2008-06-19 19:13:15 UTC 
(rev 5598)
@@ -1,27 +0,0 @@
-#!/usr/bin/env python
-
-import gobject
-import gtk
-
-from pylab import *
-
-
-fig = figure(1)
-ind = arange(30)
-X = rand(len(ind),10)
-lines = plot(X[:,0], 'o')
-
-manager = get_current_fig_manager()
-def updatefig(*args):
-    lines[0].set_data(ind, X[:,updatefig.count])
-    manager.canvas.draw()
-    updatefig.count += 1
-    if updatefig.count<10:
-        return True
-    else:
-        return False
-
-updatefig.count = 0
-
-gobject.timeout_add(300, updatefig)
-show()

Added: trunk/matplotlib/examples/animation/gtk_timeout.py
===================================================================
--- trunk/matplotlib/examples/animation/gtk_timeout.py                          
(rev 0)
+++ trunk/matplotlib/examples/animation/gtk_timeout.py  2008-06-19 19:13:15 UTC 
(rev 5598)
@@ -0,0 +1,19 @@
+import gobject
+import numpy as np
+import matplotlib
+matplotlib.use('GTKAgg')
+
+import matplotlib.pyplot as plt
+
+fig = plt.figure()
+ax = fig.add_subplot(111)
+line, = ax.plot(np.random.rand(10))
+ax.set_ylim(0, 1)
+
+def update():
+    line.set_ydata(np.random.rand(10))
+    fig.canvas.draw_idle()
+    return True  # return False to terminate the updates
+
+gobject.timeout_add(100, update)  # you can also use idle_add to update when 
gtk is idle
+plt.show()


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins

Reply via email to