can someone explain why ..

Grant Edwards grante at visi.com
Tue Apr 25 21:06:17 EDT 2006


On 2006-04-25, Farshid Lashkari <lashkariNO at SPAMworldviz.com> wrote:
> Schüle Daniel wrote:
>> I don't understand what is the difference between commented lines
>> 1 and 2
>> 
>> with 1 uncommented and 2 commented it works as expected
>> with 1 commented and 2 uncommented the picture doesn't appear
>
>
> I'm not familiar with Tkinter, but it seems as thought with 2, the 
> "image" variable is garbage collected after the constructor of Main is 
> called. With 1, you save a reference to the image, so it does not get 
> garbage collected.

Yes. That's exactly correct.  It's sort of a FAQ. See the
highlighted note at the bottom of 

http://effbot.org/tkinterbook/bitmapimage.htm

-- 
Grant Edwards                   grante             Yow!  LOU GRANT froze
                                  at               my ASSETS!!
                               visi.com            



More information about the Python-list mailing list