I am new to Tkinter and i am trying to add an image to a text widget in Tkinter python 2.7 I have looked up some resources on the internet and as far as i have gotten is this code but it is giving error - "
File "anim.py", line 11, in <module>
text.image_create(END,image=photoImg)
File "C:\Python27\lib\lib-tk\Tkinter.py", line 2976, in image_create
*self._options(cnf, kw))
TypeError: __str__ returned non-string (type file)
"
please tell me where i went wrong. Thanks in advance :)
from PIL import Image,ImageTk
from Tkinter import *
root = Tk()
root.geometry("900x900+100+100")
image1 = open('IMG_20160123_170503.jpg')
photoImg = PhotoImage(image1)
frame = Frame(root)
frame.pack()
text = Text(frame)
text.pack()
text.image_create(END,image=photoImg)
root.mainloop()