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 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
|
def selection():
"""Permet de capturer les choix de l'utilisateur"""
# nonlocal v_choix
i_choix = t_choix.curselection() # Si i_choix = Index table t_choix = (1, 2, 3)
v_choix[0] = list(t_choix.get(iv) for iv in i_choix) # Alors v_choix = Valeur v_choix = [5, 2, 1]
if not i_choix:
v_choix[0] = box_6.copy() # Quand il n'y a pas de choix, c'est que tout est choisi.
(lineno(), "\n*** sélection_if v_choix:", v_choix, "\n*** i_choix:", i_choix)
(lineno(), "\n*** sélection v_choix:", type(v_choix[0][0]), "\n***")
print(lineno(), "focus :", root.focus_get())
window.focus_set()
window.destroy()
return v_choix
def initialise():
nonlocal v2_choix
v2_choix = selection()
(lineno(), "\n*** sélection v2_choix:", v2_choix, "\n***")
for dtk, dtv in dic_taux.items():
dtk6 = dtk % 6
if dtk6 == 0:
dtk6 = 6
ray = ((int_sec * float(dtv[0])) // 100) + (int_sec * (int(dtv[1]) - 1))
ang = dtk6 * six0
(lineno(), "ray:", ray, "ang:", ang, "dtk:", dtk, "dtv:", dtv, "centre0:", centre0)
x6 = ray * math.cos(math.radians(ang)) + centre0[0]
y6 = ray * math.sin(math.radians(ang)) + centre0[1]
xy6 = x6, y6
if y6 > centre0[1]: # centre0[1] = 534
pos0 = (210 - (y6 - centre0[1]))
(lineno(), "if y6:", y6, "pos0:", pos0, "dtk6:", dtk6)
else:
pos0 = ((centre0[1] - y6) - 210)
(lineno(), "else y6:", y6, "pos0:", pos0, "dtk6:", dtk6)
if dtk6 == 6:
dtk6 = 0
"# Intersection (rayon, barre)"
(lineno(), "xy6:", xy6, "dtk:", dtk, "dtk6:", dtk6, type(dtk6), "v2_choix.val:", v2_choix[0])
if dtk6 in v2_choix[0]:
# Tracer les rayons
cant.create_line(centre0, xy6, fill=color6[dtk6], width=3)
# Liaison rayon et barre
cant.create_line(xy6, dic_axe[dtk], fill=color6[dtk6], width=2, dash=(1, 1))
(lineno(), "in v2_choix dtk6:", dtk6, "v2_choix.values:", v2_choix[0])
if dtk6 not in sax0: # La ligne d'indication du numéro de rayon.
cant.create_line(xy6, (xy6[0], xy6[1] + pos0), fill=color6[dtk6], width=1)
cant.create_text(xy6[0], xy6[1] + (pos0 + 6), text=str(dtk6), fill='black', font=c_ovale)
sax0.append(dtk6)
(lineno(), "sax0:", sax0)
(lineno(), "sax0:", sax0, "v2_choix:", v2_choix)
# ...
for child in root.winfo_children(): # Pour supprimer les fenêtres déjà ouvertes.
if isinstance(child, Toplevel):
if child.winfo_exists():
(lineno(), "graphes_window : ", child)
child.destroy()
window = Toplevel(root)
window.geometry('300x150')
window.title("Choix liste")
t_choix = Listbox(window, selectmode="multiple")
t_choix.pack(expand=YES, fill="both")
c_bouton = Button(window, text="Valider", name="bou_lis", command=initialise)
c_bouton.place(x="30", y="120")
for each_item in range(len(box_6)):
t_choix.insert(END, box_6[each_item])
t_choix.itemconfig(each_item, bg="yellow" if each_item % 2 == 0 else "cyan")
window.bind("<ButtonRelease>", c_bouton.focus_set())
c_bouton.focus_set()
(lineno(), "\n*** dic_six:", dic_six, "\n*** box_6:", box_6, "\n***")
# État du window_Protocole
(lineno(), "v2_choix:", v2_choix)
window.protocol("WM_DELETE_WINDOW", initialise)
(lineno(), "\n Fonte", c_ovale, "sax0:", sax0)
(lineno(), " Positions max_paires max_dro", max_dro, "max-min", (max_dro - min_gau))
(lineno(), " Positions max impaires min_gau", min_gau)
(lineno(), " Positions bas_impaires lig_hau", lig_hau) |
Partager