Image buttons with Tkinter

Thomas Lane tlane at parlant.com
Mon Nov 8 18:17:10 CET 1999


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.
Here is a code snippet of what I'm trying to do:

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

What am I doing wrong here?

Also, is there a place on the net where I can find lots of sample
Python/Tkinter code? I've read Fredrik Lundh's intro, but I haven't been
able to find any other code or reference material for Tkinter.

-- 
Thomas Lane
Provo, UT
tlane at parlant.com




More information about the Python-list mailing list