ajout fonctionnalité affichage stack
This commit is contained in:
parent
422289ee55
commit
5359c5178d
@ -33,8 +33,6 @@ scrollbar.pack(side=tk.RIGHT, fill=tk.Y)
|
||||
|
||||
mylist = tk.Listbox(stack_frame, yscrollcommand=scrollbar.set, width=50)
|
||||
|
||||
for line in range(30):
|
||||
mylist.insert(tk.END, "This is line number " + str(line))
|
||||
|
||||
mylist.pack(side=tk.LEFT, fill=tk.BOTH)
|
||||
scrollbar.config(command=mylist.yview)
|
||||
@ -151,15 +149,16 @@ label_sp.pack(pady=5)
|
||||
#val = subprocess.run(["/usr/bin/python3", "/home/aurelien/Documents/24hducode2026/24H_du_code_2026/Epreuve3.py", "test_bin_epreuve3/call_label.bin"] # transforme bytes en str)
|
||||
|
||||
|
||||
with open("test_bin_epreuve3/sub_val.bin", "rb") as f:
|
||||
with open("test_bin_epreuve3/cmp_reg.bin", "rb") as f:
|
||||
program = f.read()
|
||||
|
||||
sim = e3.Simulator(program)
|
||||
sim_iter = sim.run()
|
||||
|
||||
|
||||
previous_sp = None # Initialisation avant la première itération
|
||||
|
||||
def update_gui():
|
||||
global previous_sp # Accéder à la variable globale previous_sp
|
||||
try:
|
||||
state = next(sim_iter)
|
||||
|
||||
@ -178,9 +177,19 @@ def update_gui():
|
||||
label_sp.config(text=f"{state['sp']:02X}")
|
||||
|
||||
|
||||
# 👉 exemple registres
|
||||
# registre_1_label.config(text=state["regs"][0])
|
||||
# registre_2_label.config(text=state["regs"][1])
|
||||
# Vérification du changement de valeur de SP
|
||||
if previous_sp is not None:
|
||||
print(f"SP actuel : {state['sp']}")
|
||||
# Si SP se décrémente
|
||||
if state['sp'] < previous_sp:
|
||||
mylist.insert(tk.END, state['sp'])
|
||||
# Si SP se réincrémente
|
||||
elif state['sp'] > previous_sp:
|
||||
if mylist.size() > 0:
|
||||
mylist.delete(tk.END) # On enlève la dernière ligne
|
||||
|
||||
# Mettre à jour la valeur précédente de SP pour la prochaine itération
|
||||
previous_sp = state['sp']
|
||||
|
||||
# relance automatique
|
||||
root.after(200, update_gui)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user