1
에 이미지를 추가, 나는이 문제에 대해 와서 :Tkinter를 학습하는 과정에서 버튼
<ipython-input-30-6ad3ebb78b5b> in <module>()
7 button.grid()
8 photo=PhotoImage(file="giphy.gif")
----> 9 button.config(image=photo, compound=RIGHT)
10
11 root.mainloop()
/usr/lib/python3.5/tkinter/__init__.py in configure(self, cnf, **kw)
1331 the allowed keyword arguments call the method keys.
1332 """
-> 1333 return self._configure('configure', cnf, kw)
1334 config = configure
1335 def cget(self, key):
/usr/lib/python3.5/tkinter/__init__.py in _configure(self, cmd, cnf, kw)
1322 if isinstance(cnf, str):
1323 return self._getconfigure1(_flatten((self._w, cmd, '-'+cnf)))
-> 1324 self.tk.call(_flatten((self._w, cmd)) + self._options(cnf))
1325 # These used to be defined in Widget:
1326 def configure(self, cnf=None, **kw):
TclError: image "pyimage.." doesn't exist
: 그 코드에 오류가 있습니다
from tkinter import*
from tkinter import ttk
root=Tk()
button=ttk.Button(root)
button.grid()
photo=PhotoImage(file="giphy.gif")
button.config(image=photo, compound=RIGHT)
root.mainloop()
: 나는 버튼에 이미지를 추가 할 수 없습니다
왜 그렇습니까? 어떻게 해결할 수 있습니까?
오류 코드와 일치하지 않습니다. 고쳐주세요. –
나는 그것을 테스트했고 그 코드는 나에게 잘 작동한다. 오류를 재현하는 코드를 보여주십시오. – Novel
레이블과 같은 다른 tkinter의 구성 요소에 동일한 오류가 있습니다. – Korgan