dari's latest version
This commit is contained in:
		
							
								
								
									
										49
									
								
								temp.py
									
									
									
									
									
								
							
							
						
						
									
										49
									
								
								temp.py
									
									
									
									
									
								
							| @ -16,10 +16,6 @@ def reaction(cation) : | ||||
|      | ||||
|     """ | ||||
|      | ||||
|     with open('complexes_MEDTA.txt', newline='') as csvfile:  | ||||
|         liste1 = csv.reader(csvfile) | ||||
|         complexes = dict(liste1) # dictionnaire reliant cation et complexe cation-EDTA | ||||
|      | ||||
|     complexation = chemistry.Reaction({'Y4-': 1, cation: 1}, {complexes[cation]: 1}) # reaction | ||||
|      | ||||
|     return complexation | ||||
| @ -34,18 +30,6 @@ def constante_formation(cation): | ||||
|      | ||||
|     """ | ||||
|  | ||||
|     with open('logKf_EDTA.txt', newline='') as csvfile: | ||||
|         liste2 = csv.reader(csvfile) | ||||
|         constante = dict(liste2) # dictionnaire reliant cation et Kf cation-EDTA | ||||
|  | ||||
|     if cation in constante : | ||||
|      | ||||
|         Kf = 10 ** float(constante[cation]) | ||||
|      | ||||
|     else : | ||||
|      | ||||
|         cation = input("Données manquantes, veuillez introduire un nouveau cation M ou M(X): ") | ||||
|      | ||||
|     Kf = 10 ** float(constante[cation]) | ||||
|      | ||||
|     return Kf | ||||
| @ -236,7 +220,7 @@ def get_values(): | ||||
|      | ||||
|     """ | ||||
|      | ||||
|     cation = d1.get() | ||||
|     cation = valeur_actuelle.get() | ||||
|     conc_init_metal = float(d2.get()) | ||||
|     conc_ligand = float(d3.get()) | ||||
|     V_metal = float(d4.get()) | ||||
| @ -278,25 +262,42 @@ def graphique(cation, conc_init_metal, conc_ligand, V_metal, pH): | ||||
|     return fig | ||||
|      | ||||
|  | ||||
| with open('complexes_MEDTA.txt', newline='') as csvfile:  | ||||
|     liste1 = csv.reader(csvfile) | ||||
|     complexes = dict(liste1) # dictionnaire reliant cation et complexe cation-EDTA | ||||
|      | ||||
| with open('logKf_EDTA.txt', newline='') as csvfile: | ||||
|     liste2 = csv.reader(csvfile) | ||||
|     constante = dict(liste2) # dictionnaire reliant cation et Kf cation-EDTA | ||||
|      | ||||
|      | ||||
| """ Interface tkinter """ | ||||
|  | ||||
| interface = tk.Tk() # fenêtre du programme | ||||
|  | ||||
| interface.title('Complexométrie') | ||||
|  | ||||
| tk.Label(interface, text="Cation métallique titré noté Xy+ : ").grid(row=0) # donnée 1 (d1) | ||||
| tk.Label(interface, text="conc. cation (M): ").grid(row=1) # d2 | ||||
| tk.Label(interface, text="conc. ligand (M): ").grid(row=2) # d3 | ||||
| tk.Label(interface, text="vol. solution metallique (mL): ").grid(row=3) # d4 | ||||
| tk.Label(interface, text="pH : ").grid(row=4) # d5 | ||||
| # données d1-5 | ||||
| tk.Label(interface, text="Cation métallique titré: ").grid(row=0) | ||||
| tk.Label(interface, text="conc. cation (M): ").grid(row=1) | ||||
| tk.Label(interface, text="conc. ligand (M): ").grid(row=2) | ||||
| tk.Label(interface, text="vol. solution metallique (mL): ").grid(row=3) | ||||
| tk.Label(interface, text="pH : ").grid(row=4) | ||||
|  | ||||
| d1 = tk.Entry(interface) # entrées des données | ||||
| # scroll to choose : choix de cation métallique à titrer | ||||
| choix_d1 = constante.keys()  | ||||
| valeur_actuelle = tk.StringVar(interface) | ||||
| valeur_actuelle.set("Xy+") | ||||
| ions_metalliques = tk.OptionMenu(interface, valeur_actuelle, *choix_d1) | ||||
|  | ||||
| # entrées | ||||
| d2 = tk.Entry(interface) | ||||
| d3 = tk.Entry(interface) | ||||
| d4 = tk.Entry(interface) | ||||
| d5 = tk.Entry(interface) | ||||
|  | ||||
| d1.grid(row=0, column=1) # position des entrées | ||||
| # positions des entrées | ||||
| ions_metalliques.grid(row=0, column=1) | ||||
| d2.grid(row=1, column=1) | ||||
| d3.grid(row=2, column=1) | ||||
| d4.grid(row=3, column=1) | ||||
|  | ||||
		Reference in New Issue
	
	Block a user