import tkinter as tk import json import subprocess def open_program(program_path): print(f"Attempting to open: {program_path}") subprocess.Popen(program_path) def load_programs(): with open('program_list.json') as f: data = json.load(f) return data def program_clicked(program_path): open_program(program_path) def populate_listbox(programs): for program in programs: program_name = program['Name'] program_path = program['Pfad'] listbox.insert(tk.END, program_name) listbox.bind('<>', on_select) def on_select(event): index = listbox.curselection()[0] selected_program = programs[index] program_clicked(selected_program['Pfad']) # Erstelle das Hauptfenster root = tk.Tk() # Erstelle eine Listbox listbox = tk.Listbox(root) listbox.pack() # Lade die Programme aus der JSON-Datei programs = load_programs() # Fülle die Listbox mit den Programmen populate_listbox(programs) # Starte die GUI-Schleife root.mainloop()