#!/usr/bin/python # ================================================================== # Tk Canvas Image # ------------------------------------------------------------------ # From: stackoverflow.com/questions/43009527/ # how-to-insert-an-image-in-a-canvas-item # ================================================================== from tkinter import * # create the canvas, size in pixels canvas = Canvas(width=800, height=400, bg='black') # pack the canvas into a frame/form canvas.pack(expand=YES, fill=BOTH) ## load the .gif image file ##image1 = PhotoImage(file='small_globe.gif') # load png image image1 = PhotoImage(file='ludlow.png') # put gif image on canvas # pic's upper left corner (NW) on the canvas is at x=50 y=10 canvas.create_image(50, 10, image=image1, anchor=NW) # run it ... mainloop()