[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [sumo-user] Traci/Tkinter : How to play pause simulation?
|
Hi Bijal,
this works pretty good with tkinter
In the main program you should have something like
root = Tkinter.Tk()
# your dialog stuff e.g. start = StartDialog(root)
# start the sim step loop after some waiting time
root.after(100, simStep, root)
# start your sumo
root.after_idle(traci.start, [sumoBinary, "-c",
"junction2.sumocfg",
"--tripinfo-output", "tripinfo.xml"])
The simStep call back should have this pattern
def simStep(root):
"""execute one step as callback from the UI"""
# do whatever you want to do during simulation
# check if all cars are done, then finish, else schedule the
netx iteration
if traci.simulation.getMinExpectedNumber() <= 0:
traci.close()
sys.stdout.flush()
else:
root.after_idle(simStep, root)
Greetings, Harald
Am 24.04.20 um 07:31 schrieb Jakob
Erdmann:
A traci simulation only runs whenever the method
traci.simulationStep gets called. (Also, you can still press
run/step/pause in sumo-gui).
_______________________________________________
sumo-user mailing list
sumo-user@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/sumo-user