|
From: Brendan B. <bre...@br...> - 2013-07-18 19:10:30
|
On 2013-07-18 06:56, Justin Lazear wrote:> Hi Michiel,
>
> On my system, deleting the timer has no effect and the timer continues
> to send events. The __del__ method seems to call the same unimplemented
> _timer_stop method. Regardless, something else has a reference to the
> timer (MPL event loop maybe?) and __del__ is not being called once the
> timer has been started. It's not clear to me what should be
stopping the
> timer in that case.
>
> Does del t stop the timer on your system? If so, could we hunt down
what
> is happening after you delete the name t that is causing the timer
to stop?
>
> I would personally prefer an explicit .stop() method, since I would
> prefer not to rely on the garbage collector's behavior being consistent
> (hard to make sure nothing else is holding a reference to timer) when
> there is a very well-defined function that does what I want.
Relying on "del t" can't be the right solution, since like you note,
it only deletes the name, not the object. If you create multiple
references to a timer and only del some of them, e.g.:
t = fig.canvas.new_timer()
x = t
del t
Then the object's __del__ will definitely not be called yet. It makes
sense to have a way to stop the timer directly, regardless of how many
names are pointing to it.
--
Brendan Barnwell
"Do not follow where the path may lead. Go, instead, where there is
no path, and leave a trail."
--author unknown
|