Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 890a1ce

Browse files
committed
fixed timing calc and forced fltkagg
svn path=/trunk/matplotlib/; revision=1671
1 parent 5b0302f commit 890a1ce

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

examples/animation_blit_fltk.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import sys
22
import fltk
3+
import matplotlib
4+
matplotlib.use('FltkAgg')
35
import pylab as p
46
import matplotlib.numerix as nx
57
import time
@@ -14,8 +16,13 @@ def __init__(self,ax):
1416
self.canvas.mpl_connect('draw_event',self.clear)
1517
self.cnt=0
1618
self.background=None
19+
20+
# for profiling
21+
self.tstart = time.time()
22+
1723
def clear(self,event):
1824
self.background = self.canvas.copy_from_bbox(self.ax.bbox)
25+
1926
def update(self,ptr):
2027
# restore the clean slate background
2128
if self.background is None:
@@ -28,14 +35,11 @@ def update(self,ptr):
2835
# just redraw the axes rectangle
2936
self.canvas.blit(ax.bbox)
3037
self.cnt+=1
31-
if self.cnt==1000:
38+
if self.cnt==200:
3239
# print the timing info and quit
33-
print 'FPS:' , 200/(time.time()-tstart)
40+
print 'FPS:' , 200/(time.time()-self.tstart)
3441
sys.exit()
3542
return True
36-
37-
# for profiling
38-
tstart = time.time()
3943

4044
ax = p.subplot(111)
4145
# create the initial line

0 commit comments

Comments
 (0)