On Sun, Apr 20, 2008 at 3:33 AM, hjc520070 <[EMAIL PROTECTED]> wrote: > > canvas.draw() is slow in animation, I have succeed in replacing it with > canvas.restore_region(). And it is wonderful. > However, in the following, I fail to make it work the same as > canvas.draw().The following code can work. And creat a dynamic line. When I > work with the statement "#self.canvas.draw()" .The result is exactly what I > want. > > However, canvas.restore_region() fail to do as canvas.draw() here. The > problem is when I refresh the line, the previous line is not clear as I want > to.Could anyone help me? Thanks.
The basic idiom is show in the attached example animation_blit.py. You create a line with the "amimated" property set True. Then calling draw will draw everything but the animated objects line, = p.plot(x, npy.sin(x), animated=True, lw=2) Then you copy the drawn region minus the animated parts as a background. On the first draw, do .background = canvas.copy_from_bbox(ax.bbox) Then to animate your line, restore the background, update your line data, and blit the region: canvas.restore_region(background) line.set_ydata(ydata) ax.draw_artist(line) canvas.blit(ax.bbox) There are animation blit examples for most GUI toolkits in the examples directory. JDH
animation_blit.py
Description: Binary data
------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users