|
@ -12,6 +12,7 @@ def lancer(k, date, temp_moy, temp_ref, donnees): |
|
|
print(donnees) |
|
|
print(donnees) |
|
|
lst_k_plus_proches = kPlusProches(k, donnees_point, donnees) |
|
|
lst_k_plus_proches = kPlusProches(k, donnees_point, donnees) |
|
|
conso_moy = PuissanceMoyenne(lst_k_plus_proches) |
|
|
conso_moy = PuissanceMoyenne(lst_k_plus_proches) |
|
|
|
|
|
print(lst_k_plus_proches) |
|
|
label9.configure(text=conso_moy) |
|
|
label9.configure(text=conso_moy) |
|
|
|
|
|
|
|
|
def lecture(fichier): |
|
|
def lecture(fichier): |
|
@ -113,50 +114,66 @@ def distance(donnees, donneespoint, i): |
|
|
def PuissanceMoyenne(lst_k_plus_proches): |
|
|
def PuissanceMoyenne(lst_k_plus_proches): |
|
|
"""Calcule la moyenne de distances entre les points """ |
|
|
"""Calcule la moyenne de distances entre les points """ |
|
|
lecture("pic-journalier-consommation.csv") |
|
|
lecture("pic-journalier-consommation.csv") |
|
|
conso_moy = 10 # sum() / len(lst_k_plus_proches) |
|
|
conso_moy = sum(lst_k_plus_proches) / len(lst_k_plus_proches) |
|
|
return conso_moy |
|
|
return conso_moy |
|
|
|
|
|
|
|
|
global colour |
|
|
|
|
|
global colourselection |
|
|
|
|
|
global count |
|
|
global count |
|
|
colour = "" |
|
|
|
|
|
colourselection= ['red', 'blue', 'white'] |
|
|
|
|
|
count = 0 |
|
|
count = 0 |
|
|
|
|
|
|
|
|
def start(parent): |
|
|
def start(parent): |
|
|
Tk.after(parent, 1000, change) |
|
|
Tk.after(parent, 80, change) |
|
|
|
|
|
|
|
|
def change(): |
|
|
def change(): |
|
|
global colour |
|
|
|
|
|
global colourselection |
|
|
|
|
|
global count |
|
|
global count |
|
|
if (count == 1): |
|
|
if (count == 1): |
|
|
fenetre.configure(bg = 'blue') |
|
|
fenetre.configure(bg = '#c0392b') |
|
|
if (count == 2): |
|
|
if (count == 2): |
|
|
fenetre.configure(bg = 'white') |
|
|
fenetre.configure(bg = '#e74c3c') |
|
|
if (count == 3): |
|
|
if (count == 3): |
|
|
fenetre.configure(bg = 'red') |
|
|
fenetre.configure(bg = '#9b59b6') |
|
|
|
|
|
if (count == 4): |
|
|
|
|
|
fenetre.configure(bg = '#8e44ad') |
|
|
|
|
|
if (count == 5): |
|
|
|
|
|
fenetre.configure(bg = '#2980b9') |
|
|
|
|
|
if (count == 6): |
|
|
|
|
|
fenetre.configure(bg = '#3498db') |
|
|
|
|
|
if (count == 7): |
|
|
|
|
|
fenetre.configure(bg = '#1abc9c') |
|
|
|
|
|
if (count == 8): |
|
|
|
|
|
fenetre.configure(bg = '#16a085') |
|
|
|
|
|
if (count == 9): |
|
|
|
|
|
fenetre.configure(bg = '#2ecc71') |
|
|
|
|
|
if (count == 10): |
|
|
|
|
|
fenetre.configure(bg = '#f1c40f') |
|
|
|
|
|
if (count == 11): |
|
|
|
|
|
fenetre.configure(bg = '#f39c12') |
|
|
|
|
|
if (count == 12): |
|
|
|
|
|
fenetre.configure(bg = '#e67e22') |
|
|
|
|
|
if (count == 13): |
|
|
|
|
|
fenetre.configure(bg = '#d35400') |
|
|
|
|
|
if (count == 14): |
|
|
|
|
|
fenetre.configure(bg = '#2c3e50') |
|
|
start(fenetre) |
|
|
start(fenetre) |
|
|
for i in range (1): |
|
|
for i in range (1): |
|
|
count = count + 1 |
|
|
count = count + 1 |
|
|
if count == 4: |
|
|
if count == 15: |
|
|
count = 1 |
|
|
count = 1 |
|
|
change() |
|
|
change() |
|
|
|
|
|
|
|
|
def recup1(): |
|
|
def recup1(): |
|
|
k = 5 |
|
|
k = value1.get() |
|
|
return k |
|
|
return k |
|
|
|
|
|
|
|
|
def recup2(): |
|
|
def recup2(): |
|
|
date = 2016 |
|
|
date = value2 |
|
|
return date |
|
|
return date |
|
|
|
|
|
|
|
|
def recup3(): |
|
|
def recup3(): |
|
|
temp_moy = 34 |
|
|
temp_moy = value3.get() |
|
|
return temp_moy |
|
|
return temp_moy |
|
|
|
|
|
|
|
|
def recup4(): |
|
|
def recup4(): |
|
|
temp_ref = 41 |
|
|
temp_ref = value4.get() |
|
|
return temp_ref |
|
|
return temp_ref |
|
|
|
|
|
|
|
|
def calc_conso(): |
|
|
def calc_conso(): |
|
@ -170,7 +187,7 @@ entree1 = Entry(fenetre, textvariable=value1) |
|
|
|
|
|
|
|
|
label2 = Label(fenetre, text="Veuillez entrez la date (format 'aaaa-mm-jj'):", font = |
|
|
label2 = Label(fenetre, text="Veuillez entrez la date (format 'aaaa-mm-jj'):", font = |
|
|
txt_design, bg ='#005dff', foreground="#ff5733") |
|
|
txt_design, bg ='#005dff', foreground="#ff5733") |
|
|
value2 = IntVar() |
|
|
value2 = IntVar() #TRANSFO STR |
|
|
entree2 = Entry(fenetre, textvariable=value2) |
|
|
entree2 = Entry(fenetre, textvariable=value2) |
|
|
|
|
|
|
|
|
label3 = Label(fenetre, text="Veuillez entrez la température moyenne (en °C):", font = |
|
|
label3 = Label(fenetre, text="Veuillez entrez la température moyenne (en °C):", font = |
|
@ -195,9 +212,9 @@ entree3.grid() |
|
|
label4.grid(pady=10) |
|
|
label4.grid(pady=10) |
|
|
entree4.grid() |
|
|
entree4.grid() |
|
|
|
|
|
|
|
|
label9= Label(fenetre,width=8, text="Conso", bg="#b054da", fg='#fbff7a', font =('calibri',9,'bold') , relief ='groove') |
|
|
label9= Label(fenetre,width=15, text="Conso", bg="#b054da", fg='#fbff7a', font =('calibri',9,'bold') , relief ='groove') |
|
|
|
|
|
|
|
|
bouton1 = Button(canvas1, text="Tester", command=lancer(recup1(), recup2(), recup3(), recup4(), moyenne_liste()), height=2,width=8 , bg="#e7374c", fg='#fbff7a', font = |
|
|
bouton1 = Button(canvas1, text="Tester", command=lambda: lancer(recup1(), recup2(), recup3(), recup4(), moyenne_liste()), height=2,width=8 , bg="#e7374c", fg='#fbff7a', font = |
|
|
('colibri',13,'bold')).grid() |
|
|
('colibri',13,'bold')).grid() |
|
|
|
|
|
|
|
|
canvas1.grid(pady = 15) |
|
|
canvas1.grid(pady = 15) |
|
|