|
From: Donal F. <don...@ma...> - 2025-09-23 16:01:30
|
Emiliano wrote: That said, even the current docs recommends, in case of images, to use namespaces. image(n) reads "It is important to note that the image command will silently overwrite any procedure that may currently be defined by the given name, so choose the name wisely. It is recommended to use a separate namespace for image names (e.g., ::img::logo, ::img::large)." I remember writing that. It was based on the experience of doing [image create photo open ...] to make the icon for a button used to open files, and then wondering why my program broke! The important thing is avoiding overwriting existing commands. The actual workaround I originally used (in Tk 4.0, so a good while ago) was using default-named images and storing their handles in an array indexed by the names I really wanted. Donal. |