I’m using Python Imaging Library and Tkinter.
I am currently trying to display an image as a label, and I’m getting the above exception.
My 35 line source:
from PIL import Image, ImageTk
from Tkinter import Tk, Frame, Label
class Example(Frame):
def __init__(self, parent):
Frame.__init__(self, parent)
self.parent = parent
self.initUI()
def initUI(self):
self.parent.title("Label")
self.img = Image.open("diesl.jpg")
diesl = ImageTk.PhotoImage(self.img)
label = Label(self, image=diesl)
label.image = diesl
label.pack()
self.pack()
def setGeometry(self):
w, h = self.img.size
self.parent.geometry(("%dx%d+300+300") % (w, h))
def main():
root = Tk()
ex = Example(root)
ex.setGeometry()
root.mainloop()
if __name__ == '__main__':
main()
Actually, you are right in your comment: Notepad++ seems to launch the files from its own directory.
You can find the solution to your problem here: http://damienlearnsperl.blogspot.com/2009/01/launch-your-perl-script-from-notepad.html (check Lee’s comment) if you still intend to use Notepad ++