Jul-23-2019, 07:24 AM
Hi all,
1. Question:
I am learning Python in Python2 book (didn't find a better python3 book)...in a long example (which i reduced to fow lines), i has been tried to import a gif picture using the class PhotoImage... but i always get the following error :
---------------------------------------------------------------------------------------
2. Question:
this works in Python2. How do i do it in Python3 ?
1. Question:
I am learning Python in Python2 book (didn't find a better python3 book)...in a long example (which i reduced to fow lines), i has been tried to import a gif picture using the class PhotoImage... but i always get the following error :
from tkinter import * root = Tk() path = 'C:\\Users\\Desktop\\Mix\\Big pics\\wolf.gif' bild = PhotoImage(file=path) root.mainloop()
Error:Traceback (most recent call last):
File "C:\Users\mlakhili\Desktop\Python\Licht.pyw", line 4, in <module>
bild = PhotoImage(file=path)
File "C:\Python27\lib\lib-tk\Tkinter.py", line 3371, in __init__
Image.__init__(self, 'photo', name, cnf, master, **kw)
File "C:\Python27\lib\lib-tk\Tkinter.py", line 3325, in __init__
self.tk.call(('image', 'create', imgtype, name,) + options)
TclError: couldn't recognize data in image file "C:\Users\mlakhili\Desktop\Mix\Big pics\wolf.gif"
i have read in Forums that others had similar problems because they tried to import JPG or so..but i am trying with gif format, so what am i doing wrong---------------------------------------------------------------------------------------
2. Question:
this works in Python2. How do i do it in Python3 ?
import tkFileDialog path = tkFileDialog.askopenfilename()