Bonjour,
Je souhaite affiche une fenetre pop-up a mon application contenant 3 widgets de type "Scale"
chaque Scale fait appel a ma fonction "updateLabel" pour afficher la valeur définiesous le Scale
Problème: Je n'arrive pas a passer le label en parametre de ma fonction updateLabel
voici un morceau de mon code:

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
 
def updateLabel(self, x, lab):
lab.configure(text='Valeur actuelle = ' + str(x))
 
def modif_pixel(self, event):
#x = str(event.x)
#y = str(event.y)
#print x,y
 
fpixel= Tk()
 
#composante rouge
labR = Label(fpixel)
Scale(fpixel, length=400, orient=HORIZONTAL, label ='Composante Rouge :',
troughcolor ='dark grey', sliderlength =20,
showvalue =0, from_=0, to=255, tickinterval =25,
command=lambda parametre1=labR : self.updateLabel(parametre1)).pack()
labR.pack()
 
#composante verte
labV = Label(fpixel)
Scale(fpixel, length=400, orient=HORIZONTAL, label ='Composante Verte :',
troughcolor ='dark grey', sliderlength =20,
showvalue =0, from_=0, to=255, tickinterval =25,
command=lambda parametre1=labV : self.updateLabel(parametre1)).pack()
labV.pack()
 
#composante bleue
labB = Label(fpixel)
Scale(fpixel, length=400, orient=HORIZONTAL, label ='Composante Bleue :',
troughcolor ='dark grey', sliderlength =20,
showvalue =0, from_=0, to=255, tickinterval =25,
command=lambda parametre1=labB : self.updateLabel(parametre1)).pack()
labB.pack()
 
fpixel.mainloop()
PS: j'ai lu qu'automatiquement la valeur du scale est envoyé a la fonction (ici x) mais comment dois je faire pour passer un autre parametre ?

Merci pour votre aide