Image buttons with Tkinter

Thomas Lane tlane at
Tue Nov 9 10:50:47 EST 1999

Thanks for the help Fredrik.
I am new to Python, so this particular effect of scoping was not
apparent to me at first.
Since I was doing this inside a method I changed my code to look like:

# Put remove.gif on a button (actionbar is a frame for various controls)
self.image_delete = PhotoImage(file="remove.gif")
deletebutton = Button(actionbar,image=image_delete)

That solved the problem.
Thomas Lane
Provo, UT
tlane at

Fredrik Lundh wrote:
> Thomas Lane wrote:
> > I'm trying to create a button that displays an image instead of text,
> > but I don't seem to be having any luck. The button just comes up gray.
> see:
>     4.69. Images on Tk-Buttons don't work in Py15?
> </F>
> <!-- (the eff-bot guide to) the standard python library:
> -->

More information about the Python-list mailing list