#images_sample.py from Tkinter import * root = Tk() # Create the root (base) window where all widgets go # Create the PhotoImage widget im = PhotoImage(file='cake.gif') # Create a canvas myCanvas = Canvas(root, width=400, height=400, background='green', borderwidth=10,relief=RAISED) myCanvas.create_line(0, 0, 200, 100) myCanvas.create_line(0, 100, 200, 0, fill="red", dash=(4, 4)) myCanvas.create_image(0, 200, anchor=NW, image=im) myCanvas.pack() myButton = Button(root, text="Exit", command=root.destroy) myButton.pack() root.mainloop() # Start the event loop