Read my book

I wrote books about Webpack and React. Check them out!

Monday, January 11, 2010

Placidity - Bounce Experiment (VPython)

It would be somewhat cool to be able to use Placidity as a visualization tool. I just took my first step towards this direction. I ported "bounce" example of VPython to a command.

The current version is not perfect as it blocks the user input. In other words after running it, quitting (ctrl-c) kills the whole application. This is due to the way I implemented window refresh.

I set up a thread that calls an update function on a predefined interval. I used Geoffrey Foster's RepeatTimer for this.

You can find the source of this experimental command here.

Apparently fixing the user input issue should not be too hard. I just need to set up a separate thread for polling user input instead of using raw_input as explained here. I will look into wrapping up "bounce" after the next part of my tutorial series in which I implement "quit" command to Placidity.