Bonjour

Dans une interface graphique j'utilise Pillow pour modifier une image dans un canevas.
Lorsque j'exécute mon fichier en mode console pas de soucis. Par contre sous PyCharm j'ai une erreur ModuleNotFoundError: No module named 'PIL'
Le module Pillow est déjà installé dans ma config.
J'ai créer dans le même projet un fichier test pour contrôler et cela fonctionne.
Je ne comprends pas pourquoi dans le même environnement un des fichiers s'exécute et pas l'autre.

A part des fonctions complémentaires n'ayant pas de rapport avec l'UI voici le code des 2 fichiers


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
36
37
38
39
40
 
import time
from threading import Thread
from tkinter import *
import tkinter as tk
from PIL import Image, ImageTk
 
def charger_image(filename, resize=None):
    img = Image.open(filename)
 
    if resize is not None:
        img = img.resize(resize, Image.ANTIALIAS)
    photo = ImageTk.PhotoImage(img)
    return photo
 
 
# Création de la fenêtre principale
root = tk.Tk()
root.title("Test")
root.geometry('480x200+1100+10')
 
 
photo = charger_image("picture/carius.png")
photo2 = charger_image("picture/busy.png")
photo3 = charger_image("picture/donate.png")
 
 
Can = tk.Canvas(root, width=480,height=120)
Can.place(x=0, y=0)
Can.create_image(0,0, anchor=NW, image=photo)
 
 
Can1 = tk.Canvas(root, width=480,height=59,bg='white')
Can1.place(x=0, y=121)
idimage = Can1.create_image(480, 59, anchor=SE, image=photo3)
 
tk.Button(root, text='Se connecter').place(x=10, y=140)
tk.Button(root, text='Lancer la récupération',command=lancer).place(x=100, y=140)
 
root.mainloop()