[PythonCE] Tkinter PhotoImage, no such file or directory

Patrick Kramer pkramer at meton.net
Fri Apr 28 09:30:19 CEST 2006


I have two files which are both in the PyGlucoCE directory off of root.

Tkintertest.py
BtnGluco.gif



Here is my code:

import sys

sys.path.append('\\Program Files\\Python24\\python24.zip\\lib-tk')
sys.path.append('\\PyGlucoCE')

from Tkinter import *

root = Tk()

ImgGlucose = PhotoImage(file = 'BtnGluco.gif')

print ImgGlucose.height()

b = Button(root, image=ImgGlucose)
b.image = ImgGlucose
b.pack()

root.mainloop()



Now I get this error:

_tkinter.TclError: couldn't open "BtnGluco.gif": no such file or directory




The weird part is I get the same error within Pydev, but if I run the script straight through commandline, it works and shows the image as a button.

My guess is I screwed up the path append, but it looks correct to me :/


More information about the PythonCE mailing list