From 8a6fa3e2704fc72be3facd95fdf4a47f0159fd75 Mon Sep 17 00:00:00 2001 From: mrraclette Date: Sun, 15 Oct 2023 14:19:49 +0200 Subject: [PATCH] Gui fonctionelle --- GUI/main.py | 142 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 142 insertions(+) create mode 100644 GUI/main.py diff --git a/GUI/main.py b/GUI/main.py new file mode 100644 index 0000000..0e0a3a3 --- /dev/null +++ b/GUI/main.py @@ -0,0 +1,142 @@ +from tkinter import * +from tkinter import ttk +from tkinter import messagebox + +import tkinter as tk + +#creation première fenetre +window = Tk() +def __init__(window): + Tk.__init__(window) + window.create_menu_bar() +#personnalisation fenêtre +window.title("Choix EDS") +window.geometry("1080x720") +window.minsize(480, 360) +window.maxsize(1920, 1080) +window.iconbitmap("GUI/bitmap.ico") +window.config() + +Thm = "#aaaaaa" +def makeSomething1(): + Thm = "#aaaaaa" + print(Thm) +def makeSomething2(): + Thm = "#35363a" + print(Thm) +#Listbox/scrollbar +#création scrollbar +scrollbar = ttk.Scrollbar(window) +listbox = tk.Listbox(window, yscrollcommand=scrollbar.set) +scrollbar.config(command=listbox.yview) + +scrollbar.pack(side=tk.RIGHT, fill=tk.Y) +listbox.pack(fill=tk.BOTH, expand=True) +#CREATIONN DES FRAMES +#création d'une frame principale +frame = ttk.Frame(listbox) + +#création d'une frame haute +highframe = ttk.Frame(frame) + +#création d'une frame basse +bottomframe = ttk.Frame(frame) + +#création d'une frame gauche +leftframe = ttk.Frame(bottomframe) + +#création d'une frame droite +rightframe = ttk.Frame(bottomframe) + +#Création menu bar + +menubar = Menu(window) +window.config(menu=menubar) +menuabout = Menu(menubar,tearoff=0) +menunon = Menu(menubar,tearoff=0) +def msgabout(): + messagebox.showinfo("Choix EDS - En savoir plus ...", "By Raphael et Elouan") +def msgabout1(): + messagebox.showinfo("Choix EDS - Code Source", "git : https://git.tipragot.fr/Naomana/Choix_Spe") +def msgabout2(): + for i in range (100): + messagebox.showinfo("Choix EDS - Il fallait pas", "Je l'avais, dit, il ne faut pas clicker") +menubar.add_cascade(label="A propos", menu=menuabout) +menubar.add_cascade(label="Non", menu=menunon) +menuabout.add_command(label="Code source", command=msgabout1) +menuabout.add_command(label="En savoir plus...", command=msgabout) +menunon.add_command(label="Ne pas toucher", command=msgabout2) + + + + + +#AJOUT ET AFFICHAGE DES ELEMENTS +#affichagge image +can = Canvas(highframe, width = 200 , height = 100) + +can.pack() +Objet_Image = PhotoImage(file='GUI/Logo.png') +Image_Affichee = can.create_image(0,0, image = Objet_Image, anchor='nw') +#ajouter le titre +label_title = ttk.Label(highframe, text="Aide au choix des spécialités", font=("Arial", 31)) +#afficher le titre +label_title.pack(side=tk.TOP, pady=8) + +#ajouter la description +label_subtitle = ttk.Label(highframe, text="Cette application est une assistance pour le choix des EDS et du parcours post BAC", font=("Arial", 16)) +#afficher la description +label_subtitle.pack() + +#ajouter un champ de texte +int_prompt = ttk.Entry(leftframe, font=("Arial", 16)) +#afficher le champ de texte +int_prompt.pack(expand=YES, fill=X, pady=25) + +#ajouter un bouton +#définir fonction du bouton + +def getEntry(*_): + prompt = int_prompt.get() + print(prompt) + +click_btn= PhotoImage(file='GUI/Search_button.png') +#Let us create a label for button event +img_label= Label(image=click_btn) + +#Let us create a dummy button and pass the image +button= Button(rightframe, image=click_btn,command= getEntry, +borderwidth=0) +button.pack(pady=30) + + + +#creer bouton + +#assingner boutton entrée +window.bind("", getEntry) + + +#AFFICHAGE DES FRAMES +#affichage frame haute +highframe.pack(side=TOP) + +#affichage frame basse +bottomframe.pack(side=BOTTOM) + +#affichage frame droite +rightframe.pack(side=RIGHT, padx=10) + +#affichage frame gauche +leftframe.pack(side=LEFT, padx=10) + +#afficher la frame +frame.pack(fill=tk.BOTH) + +#TRAITER INFORMATION USER +#Récupérer l'éntrée dans une variable + + + +#affichage dans la boucle main +window.mainloop() \ No newline at end of file