|
10鱼币
- from tkinter import *
- root = Tk()
- text_label = Label(root, text='未满十八周岁者禁止观看!')
- text_label.pack()
- photo = PhotoImage(file='/Users/David/Desktop/practice/1.gif')
- image_label = Label(root, image=photo)
- image_label.pack()
- mainloop()
复制代码
求教这是怎么回事?
- /Library/Frameworks/Python.framework/Versions/3.5/bin/python3.5 /Users/David/Desktop/practice/tk1.py
- Traceback (most recent call last):
- File "/Users/David/Desktop/practice/tk1.py", line 7, in <module>
- photo = PhotoImage(file='/Users/David/Desktop/practice/1.gif')
- File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/tkinter/__init__.py", line 3394, in __init__
- Image.__init__(self, 'photo', name, cnf, master, **kw)
- File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/tkinter/__init__.py", line 3350, in __init__
- self.tk.call(('image', 'create', imgtype, name,) + options)
- _tkinter.TclError: couldn't recognize data in image file "/Users/David/Desktop/practice/1.gif"
- Process finished with exit code 1
复制代码
|
-
|