FAQ
Hi

I'm trying to build a small application that can display some images
in a toplevel window. I have this code:

def Results(master):
from Tkinter import Toplevel, Button, Label
from PIL import ImageTk

figures = ['first.png', 'second.png']

ResultsWindow = Toplevel(master)
ResultsWindow.title('Results')

picts = [ImageTk.PhotoImage(file = x) for x in figures]

butRW = Button(ResultsWindow, text = 'CLOSE', command =
ResultsWindow.destroy)
butRW.pack()

height = sum([x.height() for x in picts])
width = picts[0].width()

y = 0
for pict in picts:
label = Label(ResultsWindow,image=pict).pack()
y += pict.height()

from Tkinter import Tk
root = Tk()
Results(root)
root.mainloop()

and I just can see a grey window with a "close" button... However,
when I try the same code with the root I can see both images... Can
anyone give me a tip?

Thanks! :)

Search Discussions

Discussion Posts

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 3 | next ›
Discussion Overview
grouppython-list @
categoriespython
postedAug 22, '08 at 4:17p
activeAug 23, '08 at 10:07a
posts3
users3
websitepython.org

3 users in discussion

Pedro: 1 post Fredrik Lundh: 1 post Adam E: 1 post

People

Translate

site design / logo © 2022 Grokbase