I defined a function, solve, with a free variable n, which changes while solve is running. Therefore, evaluating
Dynamic[n]
solve[];
allows me to see the changes. But when I put solve into any sort of interface element like a button, I dont see n changing. Even if I evaluate
Dynamic[n]
bn = 0;
Dynamic[If[bn === 1, {bn = 0, solve[x]}]]
bn = 1;
I only see n change when the evaluation of solve is complete. What do I need to do to be able to observe changes to n as they happen?
Edit
With this, I see n change as evaluation progresses:
n = 0; solve[] := Do[n += 1, {1000000}]; Dynamic[n]; solve[]
With this, I only see n change at the end when it reaches 1000000:
bn = 0; Dynamic[If[bn === 1, {solve[], bn = 0}]]; bn = 1;
solve. Without this we don't have enough information to help you. – m_goldberg Feb 10 '13 at 02:57solve[] := Do[n += 1, {1000000}];
Dynamic[n]
solve[] <- This makes n changes along progress
Dynamic[If[bn === 1, {solve[], bn = 0}]];
bn = 1; <- here i see n only change at end to 2000000
– søren Feb 10 '13 at 09:50