Reputation: 179
I know there are lots of questions dealing with the removal of the tkinter icon. And the are lots of answers, but they just describe how to make the icon transparent. If you create a window with a transparent icon and add a title, there is a gap between title and edge of the window. I already tried:
root.iconbitmap(None)
but is has no effect. The icon becomes the default icon.
Is there a way to REMOVE the tkinter icon completely?
Thanks in advance.
Upvotes: 1
Views: 1462
Reputation: 49
It is not possible to remove it completely, but you can make it a white icon.
take a look at: here
import tkinter
import tempfile
ICON = (b'\x00\x00\x01\x00\x01\x00\x10\x10\x00\x00\x01\x00\x08\x00h\x05\x00\x00'
b'\x16\x00\x00\x00(\x00\x00\x00\x10\x00\x00\x00 \x00\x00\x00\x01\x00'
b'\x08\x00\x00\x00\x00\x00@\x05\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
b'\x00\x01\x00\x00\x00\x01') + b'\x00'*1282 + b'\xff'*64
_, ICON_PATH = tempfile.mkstemp()
with open(ICON_PATH, 'wb') as icon_file:
icon_file.write(ICON)
tk = tkinter.Tk()
tk.iconbitmap(default=ICON_PATH)
label = tkinter.Label(tk, text="Window with transparent icon.")
label.pack()
tk.mainloop()
Upvotes: 0