tiger20100907 发表于 2022-7-25 15:11:06

求助!

本帖最后由 tiger20100907 于 2022-7-27 09:00 编辑


from tkinter import *

root = Tk( )

textLabel = Label(root,text="您所下载的影片含有未成年人限制内容,请满18周岁后再点击!")
textLabel.pack()

photo = PhotoImage(file="18.gif")
ingLabel = Label(root, image=photo)
ingLabel.pack()

mainloop()

报错
Traceback (most recent call last):
File "C:\Users\Hp\Desktop\tk2.py", line 8, in <module>
    photo = PhotoImage(file="18.gif")
File "C:\Python34\lib\tkinter\__init__.py", line 3421, in __init__
    Image.__init__(self, 'photo', name, cnf, master, **kw)
File "C:\Python34\lib\tkinter\__init__.py", line 3377, in __init__
    self.tk.call(('image', 'create', imgtype, name,) + options)
_tkinter.TclError: couldn't recognize data in image file "18.gif"

这段代码错在哪里了

wp231957 发表于 2022-7-25 15:54:40

gif不能被识别
页: [1]
查看完整版本: 求助!