Tkinter Pencerenin Resmi

Tkinter ile oluşturduğumuz pencerenin arka planı root.config(bg = “white”) ile ekleniyor fakat bu arka plana nasıl resim eklenir denedim image ile olmadı.

Örneği incele işini görür sanırım. Yalnız resim dosyası *png uzantılı olmalı

from tkinter import *
from tkinter import messagebox
top = Tk()

C = Canvas(top, bg="blue", height=250, width=300)
filename = PhotoImage(file = "C:\\location\\image.png")
background_label = Label(top, image=filename)
background_label.place(x=0, y=0, relwidth=1, relheight=1)

C.pack()
top.mainloop
1 Beğeni