1
from tkinter import *
from tkinter import font
root =Tk()
root.title("Imagess..")
root.iconbitmap('myicon.ico')
root.mainloop()

** 'myicon.ico' file is located in "PythonProjects" where the "Images.py" is saved.

Here's what my terminal says::

spyder@penguin:~/PythonProjects$ /bin/python3  /home/spyder/PythonProjects/Images.py
Traceback (most recent call last):
  File "/home/spyder/PythonProjects/Images.py", line 8, in <module>
    root.iconbitmap(icon)
  File "/usr/lib/python3.9/tkinter/__init__.py", line 2080, in wm_iconbitmap
    return self.tk.call('wm', 'iconbitmap', self._w, bitmap)
_tkinter.TclError: bitmap "/home/spyder/PythonProjects/myicon.ico" not defined

Please, help me through this **

acw1668
  • 40,144
  • 5
  • 22
  • 34
  • 2
    ICO file is supported in Windows platform apparently. Use PNG image with `.iconphoto()` instead in Linux/MacOS. – acw1668 Feb 09 '22 at 06:06

0 Answers0