Image buttons with Tkinter
hnowak at cuci.nl
Mon Nov 8 23:36:10 CET 1999
On 8 Nov 99, at 10:17, 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. Here is
> a code snippet of what I'm trying to do:
> # Put remove.gif on a button (actionbar is a frame for various
> deletebutton = Button(actionbar,image=PhotoImage(file="remove.gif"))
This code worked for me (I threw in a label so the button will be
clearly visible rather than taking up the whole frame):
from Tkinter import *
root = Tk()
image1 = PhotoImage(file='burger.gif')
button = Button(root, image=image1)
> What am I doing wrong here?
Dunno, it looked good to me, although I never use the 'place' thingy.
> 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.
As far as I know, the Tk introduction is about the best you can get
at the moment. <waiting for Tk books...>
--Hans Nowak (zephyrfalcon at hvision.nl)
You call me a masterless man. You are wrong. I am my own master.
More information about the Python-list