1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
import ImageTk
from Tkinter import *
a=Tk()
b=ImageTk.PhotoImage(file='sam.gif', size=(150, 200), height=150, width=200)
b.height()
960 #attributs height ne marche pas
b.width()
648 #attributs width ne marche pas
b._PhotoImage__size
(648, 960) #attributs size ne marche pas non plus
#alors on va procéder ainsi:
b._PhotoImage__size=(150, 200)
b.height()
150
b.width()
200
b.._PhotoImage__size
(150, 200)
c=[b]
d= Label(a, image=c[0], height=150, width=200)
d.pack()
a.mainloop()
#et j'obtiens un bout d'image (attributs du Label (150, 200)) de la photo dans sa taille originale (648,960) |