File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11"""
22Demonstrate/test the idle and timeout API
3+
4+ This is only tested on gtk so far and is a prototype implementation
35"""
46import numpy as np
57import matplotlib .pyplot as plt
@@ -21,23 +23,12 @@ def on_idle(event):
2123 event .canvas .draw ()
2224 # test boolean return removal
2325 if on_idle .count == N :
24- fig .canvas .mpl_disconnect (on_idle .cid )
25- on_idle .cid = None
26- on_idle .count = 0
27-
28- def on_timeout (canvas ):
29- on_timeout .count += 1
30- line2 .set_ydata (np .cos (2 * np .pi * t * (N - on_idle .count )/ float (N )))
31- line2 .figure .canvas .draw ()
32- print 'timeout' , on_timeout .count
33- # test explicit removal
34- if on_timeout .count == N :
3526 return False
3627 return True
37- on_timeout .count = 0
28+ on_idle .cid = None
29+ on_idle .count = 0
3830
39- on_idle .cid = fig .canvas .mpl_connect ('idle_event' , on_idle )
40- #fig.canvas.mpl_timeout_add(100, on_timeout)
31+ fig .canvas .mpl_connect ('idle_event' , on_idle )
4132
4233plt .show ()
4334
You can’t perform that action at this time.
0 commit comments