Skip to content

Commit 6dc7cfa

Browse files
committed
fixed null message prob on gtk
svn path=/trunk/matplotlib/; revision=705
1 parent 718b8c2 commit 6dc7cfa

File tree

2 files changed

+20
-11
lines changed

2 files changed

+20
-11
lines changed

examples/anim_tk.py

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,40 @@
66

77
#import Tkinter as Tk
88
import matplotlib.numerix as numerix
9-
109
fig = matplotlib.matlab.figure(1)
1110
ind = numerix.arange(60)
11+
12+
13+
1214
x_tmp=[]
1315
for i in range(100):
1416
x_tmp.append(numerix.sin((ind+i)*numerix.pi/15.0))
1517

1618
X=numerix.array(x_tmp)
19+
20+
1721
lines = matplotlib.matlab.plot(X[:,0],'o')
1822

1923
manager = matplotlib.matlab.get_current_fig_manager()
24+
2025
def updatefig(*args):
2126
updatefig.count += 1
2227
lines[0].set_ydata(X[:,updatefig.count%60])
2328
manager.canvas.draw()
2429
return updatefig.count
2530
updatefig.count=-1
2631

27-
32+
def run(*args):
33+
print 'called run'
34+
35+
import time
36+
tstart = time.time()
37+
while 1:
38+
cnt = updatefig()
39+
if cnt==100: break
40+
print 'elapsed', 100.0/(time.time() - tstart)
41+
42+
import Tkinter as Tk
43+
manager.window.after(10, run)
2844
manager.show()
29-
import time
30-
tstart = time.time()
31-
while 1:
32-
cnt = updatefig()
33-
if cnt==100: break
34-
35-
36-
print 'elapsed', 100.0/(time.time() - tstart)
45+
Tk.mainloop()

lib/matplotlib/backends/backend_gtk.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1551,6 +1551,6 @@ def exception_handler(type, value, tb):
15511551
else:
15521552
msg = value
15531553

1554-
error_msg_gtk(msg)
1554+
if len(msg): error_msg_gtk(msg)
15551555

15561556
sys.excepthook = exception_handler

0 commit comments

Comments
 (0)