tkinter-canvas-rectangle-delete

huber nospam at wanted.com
Mon Oct 29 04:06:45 EST 2001


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")

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)

b=Button(text="delete 200",command=delz)
b.pack()
c.pack()
root.pack()

root.mainloop()

the output is :
('res', '200')
('res', '200')
...........


ther rectangle is not deleted by clicking ther button !
if I delete the elements with tag="res" ( c.delete("res") ) the 
rectangle will be deleted!

I am using : tk8.3.3 ,  tcl8.3.3 , python 2.1.1 on Suse linux 7.3

thanks in advance



More information about the Python-list mailing list