Image buttons with Tkinter

Thomas Lane tlane at parlant.com
Tue Nov 9 16:50:47 CET 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)
deletebutton.place(x=0)

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

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:
> 
>     http://www.python.org/doc/FAQ.html#4.69
>     4.69. Images on Tk-Buttons don't work in Py15?
> 
> </F>
> 
> <!-- (the eff-bot guide to) the standard python library:
> http://www.pythonware.com/people/fredrik/librarybook.htm
> -->




More information about the Python-list mailing list