Tkinter:无法识别图像文件中的数据 [英] Tkinter: Couldn't recognize data in image file

查看:538
本文介绍了Tkinter:无法识别图像文件中的数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下问题.我使用外部应用程序生成.GIF文件. 对我来说,GIF看起来不错,我可以毫无问题地打开它们. 但是,使用

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

将图像添加到Tkinter标签时,出现以下错误:

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

TclError:无法识别图像文件"C:\ Users \ D8W \ Python \ hoang \ combi中的数据 ne_model_neu \ test_bauteile \ SQTR-VO \ prev_F45_SQTR.GIF"

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"

问题是,当我将其中一个GIF上传到一些在线Converter并将其转换为"GIF"时,它们显示得非常好. 因此,生成GIF的外部应用程序正在将Tkinter不喜欢的东西放在那里.

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.

如何修改GIF以使其正常工作?解决此问题的替代方法有哪些? 我可能不会使用Python中未包含的模块(例如PIL).

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

推荐答案

我解决了它,问题出在我的外部应用程序中.我将文件指定为.GIF,但将类型设置为PNG.

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

仍然感谢

这篇关于Tkinter:无法识别图像文件中的数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆