I've switched over to Python 2.7 (from 3.4) recently, and I'm having trouble reading a .png file with Tkinter Photoimage class. I say:
background = "background.png"
photo = tk.PhotoImage(file=background)
But I get this error:
Traceback (most recent call last):
File "main.py", line 36, in <module>
photo = tk.PhotoImage(file=background)
File "c:\Python27\lib\lib-tk\Tkinter.py", line 3323, in __init__
Image.__init__(self, 'photo', name, cnf, master, **kw)
File "c:\Python27\lib\lib-tk\Tkinter.py", line 3279, in __init__
self.tk.call(('image', 'create', imgtype, name,) + options)
_tkinter.TclError: couldn't recognize data in image file "background.png"