Tired of the Tk icon in the corner of the form. It's easy to replace with any fancy icon you have. Here is the code ...

# changing the default icon in Tkinter programs

from Tkinter import *

# create the form and a label
form1 = Tk()
lbl1 = Label(form1, text='Changing the Tk icon is very easy!')
lbl1.pack(expand=YES, fill=BOTH)

# change the form/frame icon, use an icon file you have ...
form1.wm_title('New Icon')

# run it ...

I tried to use this code to replace the "tk" icon on a script, but the icon never changed. My icon size is 14x14, and the snippet where I put the code is below...

class GUIFramework(Frame):
    """This is the GUI"""
    def __init__(self,master=None):
        """Initialize yourself"""
        self.root = Tk()
        """Initialise the base class"""
        """Set the Window Title"""
        self.master.title('RSS Reader')

The closest I could get was a 16x16 'rssicon.ico' and it worked fine using your code, even with that somewhat mysterious self.master

Edited 7 Years Ago by vegaseat: n/a

Sure enough, as soon as I resized it to 16x16 the icon showed up. Thank you for your help.

this is probably a reallllyyyy old post but, im having trouble with changeing the icon.

from Tkinter import *
root = Tk()

and i get this error:

Traceback (most recent call last):
  File "file", line 3, in <module>
  File "/usr/lib/python2.5/lib-tk/Tkinter.py", line 1529, in wm_iconbitmap
    return self.tk.call('wm', 'iconbitmap', self._w, bitmap)
_tkinter.TclError: bitmap "icon.ico" not defined

the image size is 16x15

The article starter has earned a lot of community kudos, and such articles offer a bounty for quality replies.