Tkinter: Couldn't recognize data in image file

坚强是说给别人听的谎言 提交于 2019-12-20 06:56:27

问题


I have the following problem. I generate .GIF files using an external application. To me the GIFs look fine, I can open them without problems. However, using

        photo = PhotoImage(file=screenshot_file)
        self.previewImageLabel.config(image=photo)
        self.previewImageLabel.image = photo

to add an image to a Tkinter Label, is giving me the following error:

TclError: couldn't recognize data in image file "C:\Users\D8W\Python\hoang\combi ne_model_neu\test_bauteile\SQTR-VO\prev_F45_SQTR.GIF"

The thing is, when I upload one of the GIFs to some online Converter and convert them to "GIF", they get displayed perfectly fine. So my external application, which generates the GIFs, is putting something in there that Tkinter doesn't like.

How can I modify the GIFs to work? What are alternatives solving this problem? I may not use modules that are not included in Python(like PIL).

Do you have any ideas? Thanks in advance


回答1:


I solved it, the problem was within my external application. I specified the file as .GIF but I have set the type to PNG.

Thanks anyway



来源:https://stackoverflow.com/questions/28740462/tkinter-couldnt-recognize-data-in-image-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!