Ask coding questions

← Back to all posts
Tkinter Background Image
RILEYSENFTEN (0)

Does anyone know how to set the background image of a tkinter window? I am trying to set it to the "baseball.jpg" in the files window. Thanks!

Comments
hotnewtop
PYer (4010)

I can't help you directly, I don't have much experience with tkinter. A few things that might help you could be the canvas? Idk much about it. Or, see if you can add an image and just spread it along the page with the lowest z-index.

RILEYSENFTEN (0)

@PYer I had the canvas set up... not in this repl, however. My problem is when I set the image to "baseball.jpg" and then run the program nothing shows in the tkinter window. I tried in both visual studio code and repl, so I don't believe it is the fault of repl. I believe I am just doing it wrong.

PYer (4010)

@RILEYSENFTEN Could you give me the code you are using to add the image? I don't see any in the repl.

RILEYSENFTEN (0)

@PYer I updated the repl. I know for sure that the file path is correct so that is not the issue.