Ich habe ein Problem beim Anzeigen einer .tif-Datei, wenn der Pfad zu Ihr aus einer Tkinter-Listbox kommt. Hier der Code:
Code: Alles auswählen
def show_selection():
pfad = list.get("active")
datei = "%s/input.tif" % (pfad)
nf = Tk()
bild = ImageTk.PhotoImage(file=datei)
lbl_bild = Label(nf, image=bild)
lbl_bild.pack()
nf.mainloop()
Code: Alles auswählen
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Python23\lib\lib-tk\Tkinter.py", line 1345, in __call__
return self.func(*args)
File "F:\Scripts\archiv.py", line 54, in button_show_selection
show_selection()
File "F:\Scripts\archiv.py", line 81, in show_selection
lbl_bild = Label(nf, image=bild)
File "C:\Python23\lib\lib-tk\Tkinter.py", line 2370, in __init__
Widget.__init__(self, master, 'label', cnf, kw)
File "C:\Python23\lib\lib-tk\Tkinter.py", line 1835, in __init__
self.tk.call(
TclError: image "pyimage1" doesn't exist
Danke und Gruß
David