Thought I would post this as a simple GTKagg animation with patches (after John Hunter fixed it for me :-):
import pygtk, gobject import matplotlib matplotlib.use('GTKAgg') import numpy as np import matplotlib.pyplot as plt import pylab from matplotlib.patches import CirclePolygon, Polygon fig = plt.figure(figsize=(10,6)) ax = fig.add_subplot(111, autoscale_on=False ) canvas = fig.canvas plt.axis([-1, 7, -0.5, 2.2]) def update_line(): global x, y print update_line.cnt_tot if update_line.background is None: update_line.background = canvas.copy_from_bbox(ax.bbox) canvas.restore_region(update_line.background) x_cir = 1.0 + 0.003*update_line.cnt if update_line.cir is None: cir = CirclePolygon((x_cir, 1), 0.3, animated=True, \ resolution=12, lw=2 ) ax.add_patch(cir) update_line.cir = cir else: update_line.cir._xy = x_cir, 1 update_line.cir._update_transform() ax.draw_artist(update_line.cir) canvas.blit(ax.bbox) if update_line.direction == 0: update_line.cnt += 1 update_line.cnt_tot += 1 if update_line.cnt > 500: update_line.direction = 1 else: update_line.cnt -= 1 update_line.cnt_tot += 1 if update_line.cnt < 100: update_line.direction = 0 return update_line.cnt<100000 update_line.cnt = 0 update_line.cnt_tot = 0 update_line.direction = 0 update_line.background = None update_line.cir = None def start_anim(event): gobject.idle_add(update_line) canvas.mpl_disconnect(start_anim.cid) start_anim.cid = canvas.mpl_connect('draw_event', start_anim) plt.show() ------------------------------------------------------------------------------ SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users