- image create type ?name? ?option value ...?
MGS [2003/09/15] - Note that image create will overwrite existing images of the form imagex, where x is an integer:See also:
% image create photo image1 image1 % image create photo image1It appears that Tk uses an internal counter for image names, and does not check if imagex already exists.In fact, Tcl in many cases does not prevent one from creating objects that are named the same as an existing one. The difference here is that Tk is automatically generating a name that happens to match. That is the unfortunate feature.DGP: This bug (Tk Bug 808039) is corrected for Tk 8.4.5.DKF: In the meantime, don't create images explicitly named like image%d and you'll be OK.MGS: The reason I discovered this bug, was that I am writing a utility to dump the complete state of an interp to a file. Sourcing that dumped file into a new interp recreated all imagex images as named images, and then all image create commands then started overwriting ... I ended up actually overloading the image command and making sure the internal image counter was in sync with given image names.