-2

I keep receiving this error message. I googled a lot but the results didn't help. I checked the location of the file plenty of times.

from tkinter import *

root = Tk()
root.geometry('580x330')
root.configure(background='#FFFFFF')
root.title('title')
root.iconbitmap('@logo.ico')
TheLizzard
  • 7,248
  • 2
  • 11
  • 31
Valifa
  • 1
  • 1
    Please check you spelling and remove all swearing. – TheLizzard Mar 31 '21 at 11:11
  • 2
    Fixed your question. Next time I will have to report you. If you ask nicely people are more willing to help you. – TheLizzard Mar 31 '21 at 11:15
  • Have you tried using the fill file path like: `root.iconbitmap("C:/.../.../.../logo.ico")`? Also please read [this](https://meta.stackexchange.com/questions/79974/whats-the-so-policy-for-swearing) – TheLizzard Mar 31 '21 at 11:17
  • Ty, tried it but: SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape – Valifa Mar 31 '21 at 11:20
  • Look at [this](https://stackoverflow.com/questions/60299073/cant-set-icon-in-tkinter?noredirect=1&lq=1). If that doesn't help please edit your question to also include the ico. – TheLizzard Mar 31 '21 at 11:23
  • Use `r'...path'`. – Delrius Euphoria Mar 31 '21 at 11:46
  • 1
    Did you try removing the `@` character like `root.iconbitmap('logo.ico')`? – acw1668 Mar 31 '21 at 11:48

1 Answers1

0

Try this:

from tkinter import *

root = Tk()
root.geometry('580x330')
root.configure(background='#FFFFFF')
root.title('title')
# Make sure that it is the full path to your .ico file
root.iconbitmap(r"C:\...\...\...\logo.ico")
TheLizzard
  • 7,248
  • 2
  • 11
  • 31