[Tkinter-discuss] [Tutor] displaying an image

Michael Lange klappnase at web.de
Sat Oct 6 16:52:21 CEST 2012

Hi Matthew,

On Sat, 6 Oct 2012 15:36:31 +0100
Matthew Ngaha <chigga101 at gmail.com> wrote:

>  nothing seems to work with TkImg but however the gif example you
> showed me is working fine so i guess im happy with that as gimp
> successfully converts my images into gifs. I will try sending an email
> to TkImg to see if they can direct me in steps to installling the
> program.

sorry, what I completely forgot to mention about TkImg is that of course
after installing the dlls your program has to tell the Tcl/Tk Interpreter
to use it. The magic line for that in Tcl is:

    package require Img

In Python / Tkinter this can be accomplished with a single line, too, as
in this snippet (note the third line):

from tkinter import *
root = Tk()
root.tk.call('package', 'require', 'Img')
img = PhotoImage(file='imagepath.jpg')
l = Label(root, image=img)

So in case you did not try this already, there may still be hope.

Best regards


.-.. .. ...- .   .-.. --- -. --.   .- -. -..   .--. .-. --- ... .--. . .-.

Killing is stupid; useless!
		-- McCoy, "A Private Little War", stardate 4211.8

More information about the Tkinter-discuss mailing list