Skip to content

How to set background image in Python tkinter?

om tkinter import *
from PIL import ImageTk

canvas = Canvas(width=600, height=800, bg='blue')
canvas.pack(expand=YES, fill=BOTH)

image = ImageTk.PhotoImage(file="File route")
canvas.create_image(10, 10, image=image, anchor=NW)

See also  Java code snippet - How to change class name in intellij?

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.