Menu

[r540]: / trunk / htdocs / examples / anim_tk.py  Maximize  Restore  History

Download this file

37 lines (27 with data), 739 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env python2.3
import matplotlib
matplotlib.use('TkAgg')
import matplotlib.matlab
#import Tkinter as Tk
import matplotlib.numerix as numerix
fig = matplotlib.matlab.figure(1)
ind = numerix.arange(60)
x_tmp=[]
for i in range(100):
x_tmp.append(numerix.sin((ind+i)*numerix.pi/15.0))
X=numerix.array(x_tmp)
lines = matplotlib.matlab.plot(X[:,0],'o')
manager = matplotlib.matlab.get_current_fig_manager()
def updatefig(*args):
updatefig.count += 1
lines[0].set_ydata(X[:,updatefig.count%60])
manager.canvas.draw()
return updatefig.count
updatefig.count=-1
manager.show()
import time
tstart = time.time()
while 1:
cnt = updatefig()
if cnt==100: break
print 'elapsed', 100.0/(time.time() - tstart)
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.