Answers for "how to set an image as a background in tkinter"

2

background image in python

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)

mainloop()
Posted by: Guest on July-06-2020
0

tkinter background image python 3

You need to apply the grid method to the label that contains the image, not the image object:

bg_image = PhotoImage(file ="pic.gif")
x = Label (image = bg_image)
x.grid(row = 0, column = 0)
http://effbot.org/tkinterbook/photoimage.htm
Posted by: Guest on March-12-2021

Code answers related to "how to set an image as a background in tkinter"

Python Answers by Framework

Browse Popular Code Answers by Language