如何用这几行代码更改我的 tkinter 图标?

How Can I Change My tkinter icon with these few lines of code?

我看过关于这个问题的其他帖子,但不完全了解发生了什么。 这些是几行代码(我的 .ico 文件与我的脚本位于同一文件夹中)

icon = PhotoImage(file='panther.ico')
root.tk.call('wm', 'iconphoto', root._w, icon)

错误信息如下:

Traceback (most recent call last):
  File "C:\Users\ronald\Desktop\New folder\Longwood Math Game.py", line 158, in <module>
    icon = PhotoImage(file='panther.ico')
  File "C:\Users\ronald\AppData\Local\Programs\Python\Python36-32\lib\tkinter\__init__.py", line 3539, in __init__
    Image.__init__(self, 'photo', name, cnf, master, **kw)
  File "C:\Users\ronald\AppData\Local\Programs\Python\Python36-32\lib\tkinter\__init__.py", line 3495, in __init__
    self.tk.call(('image', 'create', imgtype, name,) + options)
_tkinter.TclError: couldn't recognize data in image file "panther.ico"

请记住,我的 .ICO 文件与我的源代码位于同一文件夹中

root.iconbitmap('panther.ico')

在我的代码中会是更好的选择,因为 'PhotoImage' 不支持我的 ico 文件