Bugs in close('all') with the TkAgg backend

Finally, is this really a close bug?

    > In [20]: fig=plot(range(10))

    > In [21]: close(fig) ERROR: Unrecognized argument type to
    > close

No, its a Fernando bug :slight_smile:

plot returns a list of Line2D instances. Perhaps you mean

    fig = figure()
    plot(range(10))
    close(fig)

It's OK, you can stop hitting yourself on the head now. Actually, the
error message would have been more helpful if it reported the type,
which it will do in the next release.

JDH

John Hunter wrote:

"Fernando" == Fernando Perez <Fernando.Perez@...76...> writes:

    > Finally, is this really a close bug?

    > In [20]: fig=plot(range(10))

    > In [21]: close(fig) ERROR: Unrecognized argument type to
    > close

No, its a Fernando bug :slight_smile:

plot returns a list of Line2D instances. Perhaps you mean

    fig = figure()
    plot(range(10))
    close(fig)

No, it's a John bug :slight_smile: I also had tried that, and this is what I get with TkAgg:

In [4]: fig=figure()

In [5]: plot(range(10))
Out[5]: [<matplotlib.lines.Line2D instance at 0x4110494c>]

In [6]: close(fig)

···

---------------------------------------------------------------------------
exceptions.AttributeError Traceback (most recent call last)

/home/fperez/code/python/pylab/<console>

/usr/lib/python2.3/site-packages/matplotlib/pylab.py in close(*args)
     611 elif isinstance(arg, Figure):
     612 for manager in _pylab_helpers.Gcf.get_all_fig_managers():
--> 613 if manager.figure==arg:
     614 _pylab_helpers.Gcf.destroy(manager.num)
     615 else:

AttributeError: FigureManagerTkAgg instance has no attribute 'figure'

Which is why I thought it might be the other way around. So this may be a backend-specifig bug.

But still a bug :slight_smile:

Cheers,

f