[Tkinter-discuss] [Tutor] displaying an image

Matthew Ngaha chigga101 at gmail.com
Sat Oct 6 17:14:39 CEST 2012


>
> 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)
> l.pack()
> root.mainloop()
>
> So in case you did not try this already, there may still be hope.
>
sorry that last email was sent directly by mistake. The above code has
fixed my issues and i am very happy right now:)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tkinter-discuss/attachments/20121006/2c1d564b/attachment.html>


More information about the Tkinter-discuss mailing list