Fre*_*oke 2 tkinter python-imaging-library python-2.7
尽管多个在线资源表明这是使用 PIL 调整图像大小的方法,但我还是收到了错误“PhotoImage 实例没有属性 'resize'”。有任何想法吗?
相关代码:
Deathwing = ImageTk.PhotoImage(Image.open('Deathwing.PNG'))
Deathwing2=Deathwing.resize((100,50),Image.ANTIALIAS)
picture1=Label(pictures_frame,image=Deathwing2)
picture1.grid(column=1,row=1)
Run Code Online (Sandbox Code Playgroud)
和 PIL 被导入为:
from PIL import Image,ImageTk
Run Code Online (Sandbox Code Playgroud)
对于任何有同样问题的人,我通过以下方式修复了它:
deathwing=Image.open('Deathwing.PNG')
image2=deathwing.resize((100,50),Image.ANTIALIAS)
Deathwing2=ImageTk.PhotoImage(image2)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6303 次 |
| 最近记录: |