Tk Canvas objects - Deletable?

Fredrik Lundh fredrik at pythonware.com
Thu May 6 17:10:36 EDT 1999


Randall Hopper <aa8vb at vislab.epa.gov> wrote:
> How does one delete Tkinter Canvas objects?  Or do they ever get deleted?

if you're using the Canvas.py module (I never do),
you need to explicitly call the delete method for
each item.

if you use the create methods, use the delete
method to destroy the items.

> The attached Tk script illustrates my problem.  group doesn't ever get
> deleted for some reason.

the bindings you added to the canvas point back
to the group object.

> What's a good way to debug this?  Is there any way to inspect the Python
> reference counts for an object?

sys.getrefcount (it'll always return one more than
the actual count, by technical reasons).

gotta run.

</F>





More information about the Python-list mailing list