📜  使图像适合大小 tkinter - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:22.096000             🧑  作者: Mango

代码示例2
from tkinter import *
from PIL import ImageTk, Image
root=Tk()

image = Image.open('path_to_your_image.png')
# The (450, 350) is (height, width)
image = image.resize((450, 350), Image.ANTIALIAS)
my_img = ImageTk.PhotoImage(image)
# Slightly modified, this works for me
my_lbl = Label(image = my_img)
my_lbl.pack()

root.mainloop()