corentin.bollet
7 months ago
3 changed files with 62 additions and 1 deletions
@ -0,0 +1,50 @@ |
|||
import tkinter as tk |
|||
from test import lancerTest |
|||
|
|||
class Interface(tk.Frame): |
|||
def __init__(self, master): |
|||
"""initialisation de l'interface""" |
|||
self.master = master |
|||
tk.Frame.__init__(self, master) |
|||
|
|||
self.create_menu_bar() |
|||
|
|||
|
|||
nb_voisins_proches = tk.Entry(self.master) |
|||
nb_voisins_proches.pack(fill="both") |
|||
|
|||
btn_entrer = tk.Button(frame_saisie, text='entrer') |
|||
btn_entrer.pack() |
|||
|
|||
def create_menu_bar(self): |
|||
"""crée la barre de menu""" |
|||
menu_bar = tk.Menu(self) |
|||
|
|||
menu_file = tk.Menu(menu_bar, tearoff=0) |
|||
menu_file.add_command(label="Quitter", command=self.master.destroy) |
|||
menu_bar.add_cascade(label="Fichier", menu=menu_file) |
|||
|
|||
menu_affichage = tk.Menu(menu_bar, tearoff=0) |
|||
|
|||
menu_mode = tk.Menu(menu_bar, tearoff=0) |
|||
menu_affichage.add_command(label="préfixe (polonaise)") |
|||
menu_affichage.add_command(label="infixe") |
|||
|
|||
menu_mode.add_command(label="mode interactif") |
|||
menu_mode.add_command(label="mode expression") |
|||
menu_affichage.add_cascade(label="postfixe (polonaise inversée)", menu=menu_mode) |
|||
menu_bar.add_cascade(label="Notation", menu=menu_affichage) |
|||
|
|||
menu_help = tk.Menu(menu_bar, tearoff=0) |
|||
menu_help.add_command(label="Aide") |
|||
menu_help.add_command(label="À propos") |
|||
menu_bar.add_cascade(label="Aide", menu=menu_help) |
|||
|
|||
self.master['menu']=menu_bar |
|||
|
|||
if __name__ == "__main__": |
|||
root = tk.Tk() |
|||
root.title("Vizion") |
|||
root.geometry("380x500") |
|||
app = Interface(root) |
|||
app.mainloop() |
@ -0,0 +1,11 @@ |
|||
from knn import kPlusProches |
|||
from lecture import lecture |
|||
|
|||
def lancerTest(nombre_voisins, point_a_verifier): |
|||
"""effectue prédiction""" |
|||
fichier_apprentissage = lecture("data/pic-journalier-consommation.csv") |
|||
k_plus_proches = kPlusProches(point_a_verifier, \ |
|||
fichier_apprentissage, \ |
|||
nombre_voisins) |
|||
conso_prevue = sum(k_plus_proches) / len(k_plus_proches) |
|||
return conso_prevue |
Loading…
Reference in new issue