“Как установить фоновое изображение в Python tkinter” Ответ

Как установить фоновое изображение в 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)

mainloop()
Silly Serval

Как установить фоновое изображение в Python tkinter

app = Tk()
app.title("Welcome")
image2 =Image.open('C:\\Users\\adminp\\Desktop\\titlepage\\front.gif')
image1 = ImageTk.PhotoImage(image2)
w = image1.width()
h = image1.height()
app.geometry('%dx%d+0+0' % (w,h))
#app.configure(background='C:\\Usfront.png')
#app.configure(background = image1)

labelText = StringVar()
labelText.set("Welcome !!!!")
#labelText.fontsize('10')

label1 = Label(app, image=image1, textvariable=labelText,
               font=("Times New Roman", 24),
               justify=CENTER, height=4, fg="blue")
label1.pack()

app.mainloop()
Stupid Stag

Фоновое изображение Tkinter 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
Santino

Ответы похожие на “Как установить фоновое изображение в Python tkinter”

Вопросы похожие на “Как установить фоновое изображение в Python tkinter”

Больше похожих ответов на “Как установить фоновое изображение в Python tkinter” по Python

Смотреть популярные ответы по языку

Смотреть другие языки программирования