diff --git a/examples/pylab_examples/system_monitor.py b/examples/pylab_examples/system_monitor.py index 90e5aa8de02e..07110190a2c4 100644 --- a/examples/pylab_examples/system_monitor.py +++ b/examples/pylab_examples/system_monitor.py @@ -40,12 +40,17 @@ def get_stats(): ax.set_ylabel('Percent usage') ax.set_title('System Monitor') +start = time.time() for i in range(200): # run for a little while m, c, n = get_stats() pm.set_height(m) pc.set_height(c) pn.set_height(n) - ax.set_ylim([0, 100]) + try: + fig.canvas.flush_events() + except NotImplementedError: + pass - plt.draw() +stop = time.time() +print("{fps:.1f} frames per second".format(fps=200 / (stop - start)))