Jun-04-2020, 10:00 PM
That command tells sets the image reference count to 1. Python cannot delete the image and reuse the memory.
This is what I mean by "Images in tkinter are odd". I would think that setting an image to be used in a button or a label should save that image from garbage collection. I could see if it is just stamping something on a canvas, but python treats all images this way. You need a non-local variable to keep hold of the image handle, preventing the image reference counter from going to zero, for the image to stick around.
This is what I mean by "Images in tkinter are odd". I would think that setting an image to be used in a button or a label should save that image from garbage collection. I could see if it is just stamping something on a canvas, but python treats all images this way. You need a non-local variable to keep hold of the image handle, preventing the image reference counter from going to zero, for the image to stick around.