0
我想导入一个png图像,但是我无法用正确的方法将imagetype作为参数写入Image函数。我试过写“PNG”,“imgtype =”PNG“,但它不会工作。是否有人知道如何正确书写。我使用下面的代码。我使用OSX btw。用PIL导入png图像时遇到麻烦
from Tkinter import *
import PIL
root = Tk()
img = Image("this is where i'm supppsed to write imgtype", file="image.png")
panel = Canvas(root)
panel.pack(side = "bottom", fill = "both", expand = "yes")
panel.create_image(image=img)
root.mainloop()
谢谢,它的工作。现在我遇到了一个新问题,但是..它说_imaging C模块没有安装 – ronaldfisher
我发现这篇文章在effbot.org这可能有所帮助:http://effbot.org/zone/pilimaging-not-installed。 HTM – alxwrd