0

The code below is what I have attempted. I have attempted using other codes but the results are all the same with the image not showing.

from tkinter import *

root = Tk()
root.title('Using Icons, Images, and Exit Buttons')
root.iconbitmap('c:\Python images\die1.ico')

root.mainloop()
bad_coder
  • 8,684
  • 19
  • 37
  • 59

1 Answers1

0

Since Micro$oft windoZe insists on using \ for paths, you need r"c:\Python images\die1.ico" to escape the backslashes, or two \. Otherwise ":" is meant, which is a very different char.

However better is to use pathlib.Path to handle all this for you, or the older os.path libraries.

2e0byo
  • 4,321
  • 1
  • 3
  • 22