0

I want to put as the entire app background a custom image. I read somewhere that I have to do something like this:

root = Tk()
bg_image = PhotoImage(file="C:/Users/Matteo/Desktop/fisica.png")
app = App(root,image=bg_image)
root.title("Fisica")
root.geometry("330x470")
root.mainloop()

When I try to run the code, it says:
TypeError: init() got an unexpected keyword argument 'image'

I can't understand what's the problem

Matteo Secco
  • 613
  • 4
  • 10
  • 19

1 Answers1

1

you should add the image to a label:

 Label(root, image=bg_image)

then use .pack() or .grid() to position the label to the grid.

see here:

how to put a image as a background in tkinter in python

You could have found this by searching stackoverflow/google.

You can't add the image directly to the root window.

Community
  • 1
  • 1
stetim94
  • 64
  • 1
  • 11