0

I am just learning the basics of tkinter with usingpython.com/using-tkinter. However, when I try to change the icon of the window that shows up, with an icon 'TKUsage.ico' saved in my desktop, I get the following error: TclError: bitmap "TKUsage.ico" not defined. I have ensured that the directories are the same, and I have even tried using the full file path, but it still claims the image doesn't exist. My full code is here:

import tkinter
window = tkinter.Tk()
window.wm_iconbitmap('TKUsage.ico')
lbl1 = tkinter.Label(window, text='Username:')
ent1 = tkinter.Entry(window)
lbl2 = tkinter.Label(window, text='Password:')
ent2 = tkinter.Entry(window)
btn = tkinter.Button(window, text='Button')
lbl1.pack()
ent1.pack()
lbl2.pack()
ent2.pack()
btn.pack()
window.mainloop()

Could someone tell me how to make sure it finds the image?

Ranger
  • 101
  • 1
  • 2
  • 9

0 Answers0