Adorable Trooper
Adorable Trooper

Reputation: 47

Having problems in uploading icon in tkinter

I was trying to upload an icon and figured out that it requires .ico file, so I converted it again, but it's not uploading.


root = Tk()
root.title("Tic tac toe Game")

# Inserting icon to my tic tac toe game

root.iconbitmap('img.ico')

root.mainloop()

Please help me from this issue.

This was the Error

Traceback (most recent call last):
    in wm_iconbitmap
    return self.tk.call('wm', 'iconbitmap', self._w, bitmap)
_tkinter.TclError: bitmap "img.ico" not defined

Upvotes: 0

Views: 197

Answers (1)

Tresdon
Tresdon

Reputation: 1211

An icon file isn't necessarily required, there's a way to use something other than an ico if you wanted that luxury:

from tkinter import PhotoImage
image = PhotoImage(file="favicon-32x32.png")
root.iconphoto(False, image)

Upvotes: 1

Related Questions