Bonjour, je suis en ISN et je ne trouve pas comment faire un filtre local en cliquant sur la photo sur edupython avec tkinter.

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
from lycee import *
from tkinter import *
from PIL import Image, ImageTk
 
def Filtre_local(event):
    global Img2
    image_nouvelle = Image.new('RGB', (L, H))
 
    X, Y = event.x, event.y
 
    int(X)
    int(Y)
    Xbas,Xhaut = X-5, X+5
    Ybas,Yhaut = Y-5,Y+5
    Xtotal = Xhaut - Xbas
    Ytotal = Yhaut - Ybas
    print(Xbas,Xhaut,Ybas,Yhaut)
    for largeur in range(10):
        for hauteur in range(10):
            p = IMG1.getpixel((Xbas+largeur,Ybas+hauteur))
 
            r = p[0]
            g = 0
            b = 0
            image_nouvelle.putpixel((Xbas+largeur,Ybas+hauteur), (r, g, b))
    photo = ImageTk.PhotoImage(image_nouvelle)
            # modification de l'objet "photo"
    photo_calvas.itemconfigure(afficher, image=photo)