Tuvas wrote: > I'm trying to display a picture on a Tkinter Canvas. It seems to work > fine the first time that it is displayed. However, subsequent times > running shows an error like this: > > TCLerror: Wrong # args: should be ".-1211472948 .-1211470996 addtag tag > searchCommand ?arg arg ...? > > My code works like this: > > if (pic): > canvas.delete(pic) > im=Image.open(path) > image=ImageTk.PhotoImage(im) > pic=canvas.create_image(1,1,anchor="nw", image=image) > canvas.addtag(pic) > > > Note that path is a path selected outside of the function. What happens > is the image is displayed, but with the error message. I think I should > either have to put in some kind of argument into the addtag, which > isn't documented well, or use a similar but different function. Thanks > for the help! >
I think I killed my last post trying to fix a typo. I'm very new to using NNTP. Forgive me if this is a close duplicate to something you already have in your inbox. Anyway, my corrected message goes like something like this: There are two better (more common) ways to do this: 1. Use the tag keyword argument when creating the canvas_image: pic=canvas.create_image(1,1,anchor="nw", image=image, tag="some_tag") 2. Use the Canvas.addtag_withtag method: canvas.addtag_withtag('some_tag', pic) I have yet to find Tkinter-specific documentation on the Canvas.addtag method, but the Tk documentation suggests this has the same affect as above: canvas.addtag("some_tag", "withtag", pic ) James -- http://mail.python.org/mailman/listinfo/python-list