Exemplo n.º 1
0
    tamany = tk.Button(root, text="CREA SIMULACIÓ")
    tamany["command"] = lambda: asignar_params(num)
    tamany.pack()

    root.mainloop()

    root = tk.Tk()
    root.title("ROBOT AMB PASSADISSOS ESTRETS")
    mf = MainFrame(root, n)
    mf.pack(side="left", fill="both", expand=True)
    a = Robot(n)

    # Botó per inserir els murs
    mur = tk.Button(root, text="Mur", bg="Grey", width=5, height=2)
    mur["command"] = lambda: mf.afegirElement(1)
    mur.pack(side="top", fill="both")

    # Botó per inserir l'agent en una posició en concret
    agent = tk.Button(root, text="Agent", bg="Grey", width=5, height=2)
    agent["command"] = lambda: mf.afegirElement(2)
    agent.pack(side="top", fill="both")

    # Botó per inicialitzar la simulació
    init = tk.Button(root, text="Inicialitza", bg="yellow")
    init["command"] = lambda: mf.inicialitza(a)
    init.pack(side="bottom", fill="both")

    lbl = tk.Label(root, text="Escull la velocitat")
    lbl.pack(side="top", fill="both")
    # Definim els radio buttons per a definir la velocitat segons 3 nivells