我正在查看删除 Tkinter 窗口上的 TK 图标,但是在尝试复制代码时遇到错误。下面是代码和错误
from Tkinter import *
import Image, ImageTk
import sys
def quit(self):
self.root.destroy()
root = Tk()
root.title("GUI program")
root.iconbitmap(default="C:\easy\Pics\ILC.ico")
im = Image.open("C:\easy\Pics\No-Image-Available.jpg")
image1 = ImageTk.PhotoImage(im)
# root has no image argument, so use a label as a panel
panel1 = Label(root, image=image1)
panel1.pack(side='top', fill='both', expand='yes')
root.mainloop()
这是错误的副本:
Traceback (most recent call last):
File "C:\easy\python\IPcam\test_image.py", line 11, in <module>
root.iconbitmap(default="C:\\easy\\Pics\\transparent.ico")
File "C:\Python25\lib\lib-tk\Tkinter.py", line 1524, in wm_iconbitmap
return self.tk.call('wm', 'iconbitmap', self._w, '-default', default)
TclError: bitmap "C:\easy\Pics\transparent.ico" not defined
我遵循了所有步骤。有任何想法吗?