From: John H. <jdh...@ac...> - 2004-05-25 15:35:49
|
>>>>> "Todd" == Todd Miller <jm...@st...> writes: Todd> I tried porting anim.py to TkAgg this morning and got it Todd> basically working. There are two things that might account Todd> for the trouble you've been having: Todd> 1. With TkAgg, at least for now, you have to call the Todd> figure manager show() method with each cycle rather than the Todd> canvas draw() method. Would it be possible to reorganize tkagg so that a call to canvas.draw also triggers a blit so that the interface could be more consistent across backends? Todd> 2. The Tk timed event system requires re-registering the Todd> handler with each cycle. Or you can do something like this def updatefig(*args): updatefig.count += 1 lines[0].set_ydata(X[:,updatefig.count%60]) manager.show() return updatefig.count updatefig.count=-1 while 1: cnt = updatefig() if cnt==100: break Todd> Performance was better than I thought it would be but still Todd> kinda slow. I profiled this because it was slower than I expected. Turns out that there is a huge performance hit in the changes I made to Text to handle arbitrary rotations (a lot of time spent in Matrix getitem, multiply, etc...). With text I could get only 5 frames per second; w/o text I get 13 fps. The good news is that it will be easy to optimize away most of the text based performance hit using more efficient matrix operations and caching. This can likely be improved further by using collections for drawing markers in the line class. Gary: did Todd's example help you enough to speed you on your way? JDH |