Aquí es lo que hago y funciona bastante bien ...
image = Image.open(Image_Location)
image = image.resize((250, 250), Image.ANTIALIAS) #The (250, 250) is (height, width)
self.pw.pic = ImageTk.PhotoImage(image)
hay que ir :)
EDIT:
Aquí es mi estado de importación:
from Tkinter import *
import tkFont
import Image #This is the PIL Image library
Y aquí está el código completo de trabajo me he adaptado este ejemplo a partir de:
im_temp = Image.open(Path-To-Photo)
im_temp = im_temp.resize((250, 250), Image.ANTIALIAS)
im_temp.save("ArtWrk.ppm", "ppm") ## The only reason I included this was to convert
#The image into a format that Tkinter woulden't complain about
self.photo = PhotoImage(file="artwrk.ppm")##Open the image as a tkinter.PhotoImage class()
self.Artwork.destroy() #erase the last drawn picture (in the program the picture I used was changing)
self.Artwork = Label(self.frame, image=self.photo) #Sets the image too the label
self.Artwork.photo = self.photo ##Make the image actually display (If I dont include this it won't display an image)
self.Artwork.pack() ##repack the image
Y aquí están los documentos de clase PhotoImage: http://www.pythonware.com/library/tkinter/introduction/photoimage.htm
Nota ... Después de comprobar la documentación pythonware en PhotoImage de ImageTK clase (Que es muy escasa) Parece que si su fragmento funciona más de lo debido, siempre y cuando importe la Biblioteca de "Imagen" de PIL y la Biblioteca "ImageTK" de PIL y que tanto PIL como tkinter estén actualizados. Por otro lado, ni siquiera puedo encontrar la vida útil del módulo "ImageTK". ¿Podrías publicar tus importaciones?
me siguen dando este "AttributeError: PhotoImage instancia no tiene atributo 'redimensionar '". ¿Qué necesito para importar? – rectangletangle
@ Anteater7171 Se incluye algo más de información – Joshkunz
Es (ancho, alto), no (alto, ancho). – Jacob