As most of us know in tkinter in order to properly display an image it must be assigned to a variable, however what if you don't know that amount of images that are going to be necessary? i.e. A friend list, how would one display the friends pictures?

It does, but I'm stuck in a pattern of thinking I can't get out of with the use of it, here's what I've been trying:
        for img in list1:

This just puts the word (pyimage"whatever number") in the box, which makes sense "unfortunately" any alternative ideas?

And to make sure that it wasn't just the listbox being an issue

def create_widget(self):
        for file in list1:

Edited 5 Years Ago by pyguy62: n/a

I do not know details by heart, but for this part I would think that code would go more like:
        list1=[PhotoImage(file=img) for img in 'icon_man.gif','group_icon.gif']
        for imag in list1:

Maybe even with generator expression:
        for imag in (PhotoImage(file=img) for img in 'icon_man.gif','group_icon.gif'):

Edited 5 Years Ago by pyTony: n/a

It seems the best way, at least to me, is to have a set amount labels with images on the page, and have something like a next button that will reassign the image value of the label.

This article has been dead for over six months. Start a new discussion instead.