ajout boutons et logo

This commit is contained in:
Jack Parrot 2026-03-22 06:54:46 +01:00
parent 4436c441a1
commit d85f8af745
2 changed files with 32 additions and 7 deletions

View File

@ -255,6 +255,7 @@ class Simulator:
chunk = self.ram[addr:addr+8] chunk = self.ram[addr:addr+8]
hex_values = " ".join(f"{b:02X}" for b in chunk) hex_values = " ".join(f"{b:02X}" for b in chunk)
print(f"{addr:02X}: {hex_values}") print(f"{addr:02X}: {hex_values}")
return self.ram
print("===========================\n") print("===========================\n")

View File

@ -6,19 +6,23 @@ import subprocess
import sys import sys
root = tk.Tk() 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 # Widgets are added here
#Frame principale #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) frame.pack(padx=10, pady=10)
#Frames Corps #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) 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) infos_frames.pack(padx=5, pady=5, side=tk.RIGHT)
@ -42,18 +46,32 @@ scrollbar.config(command=mylist.yview)
#Frame instruction suivante #Frame instruction suivante
single_inst_frame = tk.Frame(instructions_frame, width=400, height=100, bg="grey") single_inst_frame = tk.Frame(instructions_frame, width=400, height=100, bg="#89B4E1")
single_inst_frame.pack(padx=5, pady=5, side=tk.BOTTOM) single_inst_frame.pack(padx=5, pady=5, side=tk.TOP)
Label(single_inst_frame, text=f"Instruction").pack(pady=5, side=LEFT) 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 = Label(single_inst_frame, text=f"instruction+cycle", width=30, bg="white")
single_instr.pack(pady=5, side=tk.LEFT) 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 #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) registres_frames.pack(padx=10, pady=10, side=tk.TOP)
@ -101,7 +119,7 @@ label_registre_4.pack(pady=5)
#Frame annexes #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) 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 # Mettre à jour la valeur précédente de SP pour la prochaine itération
previous_sp = state['sp'] 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 # relance automatique
root.after(200, update_gui) root.after(200, update_gui)