To make a GUI/text IDE work similarly to the Logo-style animated execution you'd need to make the Python code work more slowly than normal. You could probably hook up a sys.settrace that stops when you finish a given operation and waits on a message from the GUI that it's drawn the results (and waited for the next simulation tick).
To make it work with normal GUIs, though, you'd have to use something like a "drawing queue" to which the code appended the drawing operations (since most GUIs can't handle drawing from a background thread). With that you'd be able to re-render the whole drawing queue to get to the state for the next frame of the animation. That makes the process less "drillable" for the kids, though.
It would let you have a "speed" button, something to let you slow down the process so that you could debug something, or speed it up to process a complex operation.
Would be neat if you could suspend the frame in the sys.settrace function and then resume it at some later time, which would let you interleave the GUI and running code... continuations anyone? Anyway, just a thought as we finish packing up things for the move tomorrow.
Pingbacks are closed.