Tkinter question - Canvas widget
tanzer at swing.co.at
Tue Mar 21 08:29:30 CET 2000
Tristan Juricek <tjuricek at ucsd.edu> wrote :
> This takes place within a derived frame class (which is the frame that I
> want to add the canvas to).
> pic_dlr1 = PhotoImage( file = "./pics/back1.gif" )
> self.can_dlr1 = Canvas(self)
> self.img_dlr1 = self.can_dlr1.create_image(0, 0, anchor=W,
> Right now, I see an empty space with nothing in it.
You need to keep a reference to the PhotoImage:
self.pic_dlr1 = pic_dlr1 = PhotoImage( file = "./pics/back1.gif" )
Otherwise the image is lost, when `pic_dlr1' goes out of scope.
Christian Tanzer tanzer at swing.co.at
Glasauergasse 32 Tel: +43 1 876 62 36
A-1130 Vienna, Austria Fax: +43 1 877 66 92
More information about the Python-list