I am trying to use a picture as my background in my Tkinter window but every time I try to load the image it keeps giving me this error:
Invalid argument: ':\\Users\\name\\OneDrive\\Pictures\\coins.png'
Before that I was getting a Unicode error SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 1-2: truncated \UXXXXXXXX escape
so I used this from __future__ import unicode_literals
I also tried putting an r before my normal string, doubling the forward slashes (ex. \ to \\ ), and changing my forward slashes to backward slashes. I know I need a raw string for this to work but out of ideas on how to solve it.
I would appreciate any help you guys can give me!
Here is my code:
image = Image.open(r":\Users\name\OneDrive\Pictures\coins.png")
photo = ImageTk.PhotoImage(image)
root.background_label = tk.Label(image=photo)
root.background_label.image = photo
root.background_label.place(x=0,y=0)