Bonjour,

Je me casse les dents sur PhotoImage de PythonImagingLibrary. Incompréhensible, ça tourne très bien en développement sous scite et python, mais ça ne passe pas la distribution! Le source de test et le setup sont ci-dessous. Si quelqu'un a une idée, je suis preneur, ça risque de m'enlever une belle épine du pied...

A+

Pfeuh

SETUP PIL-1.1.5.win32-py2.3.exe ***

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
from distutils.core import setup
from shutil import copy
import py2exe
 
setup(version = "0.99",description = "test bibliotheque PIL",name = "test_pil",windows = ["test_pil.py"])
copy('imgtest.jpg','dist/imgtest.jpg')
*** SOURCE QUI NE MARCHE PAS ***
*** Python-2.3.4.exe ***
*** PIL-1.1.5.win32-py2.3.exe ***

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
from time import sleep
from Tkinter import Tk,Canvas
from ImageTk import PhotoImage
 
class IMAGE(Canvas):
	def __init__(self,container,x=0,y=0):
		self.filename=''
		self.container=container
		self.x=x
		self.y=y
		Canvas.__init__(self,bd=0)
 
	def load(self,filename):
		self.image=PhotoImage(file=filename)
		self.pic=self.create_image(self.image.width()/2,self.image.height()/2,image=self.image)
		self.place(x=self.x,y=self.y,width=self.image.width(),height=self.image.height())
		self.filename=filename
		self.update()
 
	def clr(self):
		if self.filename=='':
			return
		self.filename=''
		self.place(x=self.x,y=self.y,width=0,height=0)
		self.update()
 
filename='imgtest.jpg'
 
root=Tk()
root.img=IMAGE(root,x=10,y=10)
root.geometry('800x600+0+0')
root.img.load(filename)
sleep(3)
root.img.clr()
sleep(1.5)
P.S. Génial, tous les jours j'apprends!