mise en place du changement de coleur du bouton après un clic
This commit is contained in:
parent
42ee2e72ce
commit
9fdc37fffd
@ -19,14 +19,54 @@ cadreFormatDe.pack(side=tk.TOP, anchor=tk.CENTER, pady=10)
|
|||||||
|
|
||||||
DicoBoutons = {} # création d'un Dico pour distingués les boutons
|
DicoBoutons = {} # création d'un Dico pour distingués les boutons
|
||||||
for i in [4, 6, 8, 10, 12, 20] :
|
for i in [4, 6, 8, 10, 12, 20] :
|
||||||
button = tk.CTkButton(cadreFormatDe, text= f"D{i}", width=3) # création d'un bouton
|
button = tk.CTkButton(cadreFormatDe, text= f"D{i}", hover=False, width=3) # création d'un bouton
|
||||||
button.pack(side=tk.LEFT, padx=5, pady=5) #expand=True, fill=tk.X, anchor=tk.CENTER
|
button.pack(side=tk.LEFT, padx=5, pady=5) #expand=True, fill=tk.X, anchor=tk.CENTER
|
||||||
DicoBoutons[i] = button
|
DicoBoutons[i] = button
|
||||||
|
|
||||||
def clic4 ():
|
def clic4 ():
|
||||||
print("D4")
|
print("D4")
|
||||||
|
for i in [4, 6, 8, 10, 12, 20] :
|
||||||
|
DicoBoutons[i].configure(fg_color="blue")
|
||||||
|
DicoBoutons[4].configure(fg_color="red")
|
||||||
|
|
||||||
|
def clic6 ():
|
||||||
|
print("D6")
|
||||||
|
for i in [4, 6, 8, 10, 12, 20] :
|
||||||
|
DicoBoutons[i].configure(fg_color="blue")
|
||||||
|
DicoBoutons[6].configure(fg_color="red")
|
||||||
|
|
||||||
|
def clic8 ():
|
||||||
|
print("D8")
|
||||||
|
for i in [4, 6, 8, 10, 12, 20] :
|
||||||
|
DicoBoutons[i].configure(fg_color="blue")
|
||||||
|
DicoBoutons[8].configure(fg_color="red")
|
||||||
|
|
||||||
|
def clic10 ():
|
||||||
|
print("D10")
|
||||||
|
for i in [4, 6, 8, 10, 12, 20] :
|
||||||
|
DicoBoutons[i].configure(fg_color="blue")
|
||||||
|
DicoBoutons[10].configure(fg_color="red")
|
||||||
|
|
||||||
|
def clic12 ():
|
||||||
|
print("D12")
|
||||||
|
for i in [4, 6, 8, 10, 12, 20] :
|
||||||
|
DicoBoutons[i].configure(fg_color="blue")
|
||||||
|
DicoBoutons[12].configure(fg_color="red")
|
||||||
|
|
||||||
|
def clic20 ():
|
||||||
|
print("D20")
|
||||||
|
for i in [4, 6, 8, 10, 12, 20] :
|
||||||
|
DicoBoutons[i].configure(fg_color="blue")
|
||||||
|
DicoBoutons[20].configure(fg_color="red")
|
||||||
|
|
||||||
|
|
||||||
DicoBoutons[4].configure(command=clic4)
|
DicoBoutons[4].configure(command=clic4)
|
||||||
|
DicoBoutons[6].configure(command=clic6)
|
||||||
|
DicoBoutons[8].configure(command=clic8)
|
||||||
|
DicoBoutons[10].configure(command=clic10)
|
||||||
|
DicoBoutons[12].configure(command=clic12)
|
||||||
|
DicoBoutons[20].configure(command=clic20)
|
||||||
|
|
||||||
|
|
||||||
# print(DicoBoutons)
|
# print(DicoBoutons)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user