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()

30th Nov 2016, 12:01 PM
Wira SW
Wira SW - avatar
2 odpowiedzi
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()
4th Mar 2017, 7:34 PM
vishnu
vishnu - avatar
0
1)create image with "PhotoImage" and instantiate it. 2)use your instance in "image" option
21st Feb 2018, 7:19 PM
Gourinda Adil
Gourinda Adil - avatar