1
イメージがあるウィンドウを生成できるtkinterコードを作成しようとしています。これは私にエラーを与え続けエリアです:jpegをtkinter(python3.4)に配置する方法は?
のImagePathは、マイピクチャフォルダに画像へのパスであり、これは私が
Traceback (most recent call last):
File "C:\PythonScripts\trunk\Personal\PythonWindow_ForTiming.py", line 49, in <module>
img = tk.Label(window, image=imgset)
File "C:\Python34\lib\tkinter\__init__.py", line 2604, in __init__
Widget.__init__(self, master, 'label', cnf, kw)
File "C:\Python34\lib\tkinter\__init__.py", line 2122, in __init__
(widgetName, self._w) + extra + self._options(cnf))
_tkinter.TclError: image "pyimage1" doesn't exist
を得続ける誤りである
window=tk.Tk()
window.geometry('1100x900')
window.title('Hello World')
lab1= tk.Label(window, text='Input the desired delay time')
btn=tk.Button(window, text='Go to new window', bg='Blue', command=NewTab)
btn2=tk.Button(window, text='Leave', bg='Red', command=close)
imgset=ImageTk.PhotoImage(Image.open(imgpath))
img = tk.Label(window, image=imgset)
img.pack()
lab1.pack()
btn.pack()
btn2.pack()
window.mainloop()
私は間違って何をしていますか?あなたは私はちょうどあなたが以下のように2行を追加する必要があり
ありがとうございました。非常に有益だった – Snowman