Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial


Nicholas Anstis
Nicholas Anstis
2,095 Points

How to insert an image

Is there any library that comes with python 3.5 that allows you to put images into you GUI?

I know Pillow exists but that's an external library just wondering if there's something else :P

1 Answer

Cindy Lea
Cindy Lea
Courses Plus Student 6,497 Points

I found this on Daniweb. Is this what youre looking for?

Putting a gif image on a canvas with Tkinter

tested with Python24 by vegaseat 25jun2005

from Tkinter import *

create the canvas, size in pixels

canvas = Canvas(width = 300, height = 200, bg = 'yellow')

pack the canvas into a frame/form

canvas.pack(expand = YES, fill = BOTH)

load the .gif image file

put in your own gif file here, may need to add full path

like 'C:/WINDOWS/Help/Tours/WindowsMediaPlayer/Img/mplogo.gif'

gif1 = PhotoImage(file = 'DrBunsen.gif')

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 = gif1, anchor = NW)

run it ...


Nicholas Anstis
Nicholas Anstis
2,095 Points

I guess this would work with python 2.4 but i'm using 3.5 ;}