File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import sys
22import fltk
3+ import matplotlib
4+ matplotlib .use ('FltkAgg' )
35import pylab as p
46import matplotlib .numerix as nx
57import 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
4044ax = p .subplot (111 )
4145# create the initial line
You can’t perform that action at this time.
0 commit comments