#images_sample.py from Tkinter import * def addGraphicalButton(parent): # Create the PhotoImage widget im = PhotoImage(file='cake.gif') #button2 = Button(root, text="Potato") button2 = Button(root, text="Potato", image=im) button2.image = im button2.pack() root = Tk() # Create the root (base) window where all widgets go # Create the PhotoImage widget im = PhotoImage(file='cake.gif') # Add the photo to a label: w = Label(root, image=im) # Create a label with image w.image = im # Always keep a reference to avoid garbage collection #w.pack() # Put the label into the window myButton = Button(root, text="Exit", command=root.destroy) myButton.pack() addGraphicalButton(root) root.title("This is image sample") root.mainloop() # Start the event loop