2
Contributors
4
Replies
5
Views
6 Years
Discussion Span
Last Post by JoshuaBurleson
0

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:

self.box=Listbox(self)
        self.box.pack()
        list1=['icon_man.gif','group_icon.gif']
        for img in list1:
            imag=PhotoImage(file=img)
            self.box.insert(END,imag)

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):
        self.lab=Label(self)
        self.lab.pack()
        list1=['icon_man.gif','group_icon.gif']
        for file in list1:
            word=PhotoImage(file=file)
            self.lab['image']=word

Edited by JoshuaBurleson: n/a

0

I do not know details by heart, but for this part I would think that code would go more like:

self.box=Listbox(self)
        self.box.pack()
        list1=[PhotoImage(file=img) for img in 'icon_man.gif','group_icon.gif']
        for imag in list1:
            self.box.insert(END,imag)

Maybe even with generator expression:

self.box=Listbox(self)
        self.box.pack()
        for imag in (PhotoImage(file=img) for img in 'icon_man.gif','group_icon.gif'):
            self.box.insert(END,imag)

Edited by pyTony: n/a

0

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 topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.