显示图像tkinter macOSX

时间:2018-09-09 16:22:37

标签: python tkinter

我一直在寻找从一个站点到另一个站点的时间,从一个视频到另一个视频,以寻找可行的方法。根本没有什么适合我!

from tkinter import *
import tkinter.messagebox

root = Tk()

photo = PhotoImage(file='download.jpg')
label = Label(root, image = photo)
label.pack()

root.mainloop()
Error:
/Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7 "/Users/Datboi/PycharmProjects/untitled2/Tkinter test.py"
Traceback (most recent call last):
  File "/Users/Datboi/PycharmProjects/untitled2/Tkinter test.py", line 6, in <module>
    photo = PhotoImage(file='download.jpg')
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/tkinter/__init__.py", line 3539, in __init__
    Image.__init__(self, 'photo', name, cnf, master, **kw)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/tkinter/__init__.py", line 3495, in __init__
    self.tk.call(('image', 'create', imgtype, name,) + options)
_tkinter.TclError: couldn't recognize data in image file "download.jpg"

Process finished with exit code 1

https://imgur.com/a/0RiX51A

我只是尝试以特定尺寸显示图片,但无法识别图像文件。我正在寻找替代品。

0 个答案:

没有答案