0

Code

from tkinter import *

root = Tk()

1) root.iconbitmap("/home/inspiron/git_code/mp/images/m_player.ico")

2) root.iconbitmap("m_player.ico")

3) root.iconbitmap(r"m_player.ico")

root.mainloop()

All three lines are showing error: eg. error for case 2

Traceback (most recent call last):
  File "music.py", line 5, in <module>
    root.iconbitmap(r"m_player.ico")
  File "/home/inspiron/anaconda3/lib/python3.7/tkinter/__init__.py", line 1868, in wm_iconbitmap
    return self.tk.call('wm', 'iconbitmap', self._w, bitmap)
_tkinter.TclError: bitmap "m_player.ico" not defined

I wrote all the three lines just for asking, in the code I used them separately. I saw answers of same question asked, but none of them solved this issue. Also the file m_player.ico is in the same folder in which music.py is present.

Jake Shaffer
  • 35
  • 1
  • 8
Kundan Kumar
  • 21
  • 1
  • 7
  • Possible duplicate of [Python Tkinter command "iconbitmap"](https://stackoverflow.com/questions/29973246/python-tkinter-command-iconbitmap) – stovfl Jan 25 '19 at 14:16
  • No improvements, I am using ubuntu 18.04.1 LTS , I did convert .png to .ico and also to .xbm , but it is showing same error. – Kundan Kumar Jan 25 '19 at 14:25
  • On **ubuntu** try this Answer: [iconbitmap error in ubuntu](https://stackoverflow.com/a/20860521/7414759) – stovfl Jan 25 '19 at 14:48
  • Thanks , but it solved the issue partially, using root.iconbitmap("@filename.xbm") shows no error , But while running , no icon is shown in the tkinter window. – Kundan Kumar Jan 25 '19 at 15:04
  • For me, with `LXDE`, this Answer works: [`gui.call('wm', 'iconphoto', gui._w, logo)`](https://stackoverflow.com/a/53723710/7414759) – stovfl Jan 25 '19 at 15:09
  • Wow !! It worked. Thanks again.... – Kundan Kumar Jan 25 '19 at 16:34

0 Answers0