【发布时间】:2019-10-16 10:33:35
【问题描述】:
我正在尝试放大图像并使用以下代码显示它
import tkinter as tk
from PIL import Image as PIL_image, ImageTk as PIL_imagetk
window = tk.Tk()
img1 = PIL_imagetk.PhotoImage(file="C:\\Two.jpg")
img1 = img1.zoom(2)
window.mainloop()
但是python说AttributeError: 'PhotoImage' object has no attribute 'zoom'。这里有一个相关帖子的评论:
Image resize under PhotoImage
上面写着“PIL 的 PhotoImage 没有实现 Tkinter 的 PhotoImage 的缩放(以及其他一些方法)”。
我认为这意味着我需要在我的代码中导入其他内容,但我不确定是什么。任何帮助都会很棒!
【问题讨论】:
标签: python tkinter zooming photoimage