0
How to add background image to the window?
here is my progress so far : from tkinter import * class DogeWow(): def __init__(self): window = Tk() window.title("much interest") doge = PhotoImage(file="doge-1.png") x = Label(window, image=doge) x.grid(row = 0,column = 0) DogeWow()
2 Réponses
0
from tkinter import *
from tkinter import messagebox top = Tk()
C = Canvas(top, bg="blue", height=250, width=300)
filename = PhotoImage(file ="C:\\Users\\location\\imageName.png")
background_label = Label(top, image=filename)
background_label.place(x=0, y=0, relwidth=1, relheight=1)
C.pack()
top.mainloop()
0
1)create image with "PhotoImage" and instantiate it.
2)use your instance in "image" option