tkinter-canvas-rectangle-delete
Fredrik Lundh
fredrik at pythonware.com
Mon Oct 29 06:02:02 EST 2001
huber <nospam at wanted.com> wrote:
> Can someone tell me what I am doing wrong ?
> from Tkinter import *
>
> def delz():
> for i in c.find_all():
> print c.gettags(i)
> c.delete("200")
c.delete("x200")
> root=Frame()
>
> c=Canvas(root,width=100,height=100)
> n=c.create_rectangle(0,0, 10,10, fill="red",tag="res")
> c.addtag_withtag("200",n)
c.addtag_withtag("x200",n)
> b=Button(text="delete 200",command=delz)
> b.pack()
> c.pack()
> root.pack()
>
> root.mainloop()
> ther rectangle is not deleted by clicking ther button !
integers are interpreted as item handles, not tags, even
if you pass them to Tkinter as strings.
</F>
<!-- (the eff-bot guide to) the python standard library:
http://www.pythonware.com/people/fredrik/librarybook.htm
-->
More information about the Python-list
mailing list