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

Skip to content

Commit 1bfe787

Browse files
committed
added examples/anim_tk.py
svn path=/trunk/matplotlib/; revision=317
1 parent 1292295 commit 1bfe787

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

examples/anim_tk.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/usr/bin/env python2.3
2+
3+
import matplotlib.matlab
4+
import Tkinter as Tk
5+
import matplotlib.numerix as numerix
6+
7+
fig = matplotlib.matlab.figure(1)
8+
ind = numerix.arange(60)
9+
x_tmp=[]
10+
for i in range(100):
11+
x_tmp.append(numerix.sin((ind+i)*numerix.pi/15.0))
12+
13+
X=numerix.array(x_tmp)
14+
lines = matplotlib.matlab.plot(X[:,0],'o')
15+
16+
manager = matplotlib.matlab.get_current_fig_manager()
17+
def updatefig(*args):
18+
updatefig.count += 1
19+
lines[0].set_ydata(X[:,updatefig.count%60])
20+
manager.canvas.draw()
21+
return updatefig.count
22+
updatefig.count=-1
23+
24+
25+
manager.show()
26+
import time
27+
tstart = time.time()
28+
while 1:
29+
cnt = updatefig()
30+
if cnt==100: break
31+
32+
33+
34+
35+
print 'elapsed', 100.0/(time.time() - tstart)

0 commit comments

Comments
 (0)