May-17-2020, 06:09 PM
(This post was last modified: May-17-2020, 06:10 PM by deanhystad.)
Destroying the labels does nothing to the images. The images remain as long as their reference count is > 0. Since you keep reusing PHOTO I would expect all of your labels to display the same card. Maybe they would if set all the images first and then updated.
I do not know exactly when unreferenced objects are deleted in Python, but you are defeating it somehow.
Pre-allocating the images is easy. Easier than what you are doing now.
I do not know exactly when unreferenced objects are deleted in Python, but you are defeating it somehow.
Pre-allocating the images is easy. Easier than what you are doing now.
def make_images(): spinner = ['FH', 'FD', 'FC', 'WH', 'WD', 'WC', 'JH', 'JD', 'JC', 'JS', 'QH', 'QD', 'QC', 'QS', 'KH', 'KD', 'KC', 'KS', 'AH', 'AD', 'AC', 'AS', 'BH', 'BD', 'BC'] images = [] for name in spinner: images.append(PhotoImage(file='cards/gfx/'+name+'.png') return images