Images on Dynamically Generated Buttons Glitch

MRAB python at mrabarnett.plus.com
Sun Jul 7 23:03:14 EDT 2019


On 2019-07-08 03:05, Abdur-Rahmaan Janhangeer wrote:
> You mean we should create the image variables aside like one for each 
> button? XD. Thanks!
>
You need to ensure that there's a reference somewhere to every image 
that you're displaying, whether it's on a button or some other widget, 
because tkinter itself doesn't keep a reference to the image. Sometimes 
the most convenient way is to put them in a list, but just pick what 
makes the most sense for your use case.



More information about the Python-list mailing list