From d85f8af7450efb8437376a2b11f3b97f1a039724 Mon Sep 17 00:00:00 2001 From: Jack Parrot Date: Sun, 22 Mar 2026 06:54:46 +0100 Subject: [PATCH] ajout boutons et logo --- Epreuve3.py | 1 + simulateur_front.py | 38 +++++++++++++++++++++++++++++++------- 2 files changed, 32 insertions(+), 7 deletions(-) diff --git a/Epreuve3.py b/Epreuve3.py index 1bc43e3..28a81e0 100644 --- a/Epreuve3.py +++ b/Epreuve3.py @@ -255,6 +255,7 @@ class Simulator: chunk = self.ram[addr:addr+8] hex_values = " ".join(f"{b:02X}" for b in chunk) print(f"{addr:02X}: {hex_values}") + return self.ram print("===========================\n") diff --git a/simulateur_front.py b/simulateur_front.py index 0f15558..0208636 100644 --- a/simulateur_front.py +++ b/simulateur_front.py @@ -6,19 +6,23 @@ import subprocess import sys root = tk.Tk() +root.title("Simulateur Epreuve 3 - 24H du Code 2026") +image = tk.PhotoImage(file="SII++.png") +#root.configure(bg="#0059A3") +root.configure(bg="#89B4E1") # Widgets are added here #Frame principale -frame = tk.Frame(root, width=800, height=400) +frame = tk.Frame(root, width=800, height=400, background="#89B4E1") frame.pack(padx=10, pady=10) #Frames Corps -instructions_frame = tk.Frame(frame, width=400, height=400, bg="grey") +instructions_frame = tk.Frame(frame, width=400, height=400, bg="#89B4E1") instructions_frame.pack(padx=5, pady=5, side=tk.LEFT, fill=Y) -infos_frames = tk.Frame(frame, width=400, height=400, bg="green") +infos_frames = tk.Frame(frame, width=400, height=400, bg="#89B4E1") infos_frames.pack(padx=5, pady=5, side=tk.RIGHT) @@ -42,18 +46,32 @@ scrollbar.config(command=mylist.yview) #Frame instruction suivante -single_inst_frame = tk.Frame(instructions_frame, width=400, height=100, bg="grey") -single_inst_frame.pack(padx=5, pady=5, side=tk.BOTTOM) +single_inst_frame = tk.Frame(instructions_frame, width=400, height=100, bg="#89B4E1") +single_inst_frame.pack(padx=5, pady=5, side=tk.TOP) Label(single_inst_frame, text=f"Instruction").pack(pady=5, side=LEFT) single_instr = Label(single_inst_frame, text=f"instruction+cycle", width=30, bg="white") single_instr.pack(pady=5, side=tk.LEFT) +# Boutons +buttons_frame = tk.Frame(instructions_frame, width=400, height=100, bg="#89B4E1") +buttons_frame.pack(padx=5, pady=5, side=tk.TOP) +buttonAll = tk.Button(root, text="All In") +buttonStep = tk.Button(root, text="Step By Step") + +buttonAll.pack(in_=buttons_frame, side=tk.LEFT) +buttonStep.pack(in_=buttons_frame, side=tk.LEFT) + +image_frame = tk.Frame(instructions_frame, width=400, height=100, bg="#89B4E1") +image_frame.pack(padx=5, pady=5, side=tk.TOP) + +display_image = image.subsample(10, 10) +tk.Label(image_frame, image=display_image, bg="#89B4E1").pack(padx=5, pady=5) #Frame registres -registres_frames = tk.Frame(infos_frames, width=400, height=100, bg="blue") +registres_frames = tk.Frame(infos_frames, width=400, height=100, bg="#89B4E1") registres_frames.pack(padx=10, pady=10, side=tk.TOP) @@ -101,7 +119,7 @@ label_registre_4.pack(pady=5) #Frame annexes -annexes_frames = tk.Frame(infos_frames, width=400, height=100, bg="blue") +annexes_frames = tk.Frame(infos_frames, width=400, height=100, bg="#89B4E1") annexes_frames.pack(padx=10, pady=10, side=tk.TOP) @@ -219,6 +237,12 @@ def update_gui(): # Mettre à jour la valeur précédente de SP pour la prochaine itération previous_sp = state['sp'] + ram = state['ram'] + + for addr in range(0, 256, 8): + chunk = ram[addr:addr+8] + hex_values = " ".join(f"{b:02X}" for b in chunk) + myRamList.insert(tk.END, f"{addr:02X}: {hex_values}") # relance automatique root.after(200, update_gui)