I’m developing an educational tool where the student will follow a chemical reaction. The tool starts with this interface:
When the student clicks Run
, a cool animations (should) start, particles start bouncing and reacting with each other, and all the plots are dynamically updated. At the end the result is something like:
Now the issue:
The Run
button executes a simulate!()
function. If I run it from the command line:
julia> MyChemicalSimulation.simulate!()
everthing works perfectly, and the simulation appears dynamically, all the plots are dynamically updated, as everything should be.
However, when the user actually clicks on the Run
button, the simulation runs, but plots are only updated when the simulation finishes.
In both cases the simulate!()
function is updating the same variables (global ones) that are using for plotting.
What can be wrong? Why when clicking the Run
button, the call to the same function does not dynamically updates the plots?
The button click is implemented as:
on(buttons[2].clicks) do _
simulate!()
return nothing
end
If it is impossible to give a hint without the actual code, it is here: MyChemicalSimulation.jl/src/MyChemicalSimulation.jl at main · lmiq/MyChemicalSimulation.jl · GitHub