Jan-25-2018, 08:49 PM (This post was last modified: Jan-25-2018, 08:54 PM by LeeMadeux.)
I am trying to dynamically change a displayed picture to another picture on a GUI.
I have tried various suggested ways seen on websites and none have worked this far.
What am I doing wrong?
(Jan-25-2018, 08:49 PM)LeeMadeux Wrote: I am trying to dynamically change a displayed picture to another picture on a GUI.
I have tried various suggested ways seen on websites and none have worked this far.
What am I doing wrong?
(Jan-25-2018, 08:49 PM)LeeMadeux Wrote: I am trying to dynamically change a displayed picture to another picture on a GUI. I have tried various suggested ways seen on websites and none have worked this far. What am I doing wrong?
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.