matplotlib timer

Laura Creighton lac at openend.se
Thu Oct 1 13:28:35 EDT 2015


In a message of Thu, 01 Oct 2015 17:36:50 +0100, Dave Farrance writes:
>I'm trying to set up the basics of a timer-scheduled function in
>matplotlib and I can't figure out how to stop the timer. Maybe the
>stop() method is dysfunctional in Ubuntu 14.04 or maybe I'm getting the
>syntax wrong.
>
>If anybody's got matplotlib installed, can you try this code and tell me
>if it stops after one tick as it should -- or does it continue printing
>every second without stopping as mine does?
>
>#!/usr/bin/env python
>import matplotlib.pyplot as P
>def fn():
>  timer.stop()
>  print("tick")
>fig, ax = P.subplots()
>timer = fig.canvas.new_timer(interval=1000)
>timer.add_callback(fn)
>timer.start()
>P.show()
> 

debian unstable
Python 3.4.3+ (default, Jul 28 2015, 13:17:50)

mine ticks forever, too.

Laura



More information about the Python-list mailing list