Hi, On Wed, 28 Apr 2010 14:21:21 -0700 Guido Carballo-Guerrero <char...@me.com> wrote:
> > Wayne, Michael; > > This is a sample code that shows what I'm doing. As you can see, even > if I don't have a while loop, the picture is not being shown. Am I > missing something? What is wrong with my code that I can't open and > show the picture in the new Toplevel window? > (...) > image1_1 = Image.open('20188.jpg') > image1_2 = image1_1.resize((130,200)) > photo1 = ImageTk.PhotoImage(image1_2) > > L1 = ttk.Label(F1) > L1.config(image = photo1) > L1.image = image1_2 ^^^^^^^^ That is the problem; as you noticed correctly, you have to add a reference to the PhotoImage so it does not get garbage collected. But you need to add the reference to the PhotoImage object, in this case photo1, not the PIL Image. Alternatively you can define the PhotoImage globally, i.e. outside your pic() function. I hope this helps Michael _______________________________________________ Tkinter-discuss mailing list Tkinter-discuss@python.org http://mail.python.org/mailman/listinfo/tkinter-discuss