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
  • 11,289
  • 20
  • 44
  • 72

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
  • 5,305
  • 1
  • 6
  • 26