From: Fernando P. <Fer...@co...> - 2005-01-26 05:25:26
|
Steve Chaplin wrote: > I created a module that allows interactive matplotlib access from a > python shell, its a modified version of > http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109 > > This method seems to work for me (on Linux) and is not very intrusive to > matplotlib code - it just requires that 'gui_cmd()' is used to execute > all gui commands when in interactive mode. > > Any comments? In case anyone is interested, here's a lightweight, standalone (non-ipython) GTK threaded interactive interpreter with matplotlib support. This code is also based on the same ASPN recipe, it's basically the prototype I used to understand that recipe when I was adding the matplotlib support to IPython. The threading tricks are the gold in that recipe, but the rest of the code is rather messy. I pretty much rewrote it when studying it (while keeping the threading core). Perhaps this may be of use to others. The ASPN recipe duplicates a lot of the functionality in the code.py module from the standard library, which is completely unnecessary (it's guaranteed to be there in any python installation). By using code.py, the whole thing can be rewritten much more cleanly (and you benefit from a good implementation in the stdlib for all the interpreter emulation parts). I think I sent this to John a while back so he could replace the interactive.py shipped with matplotlib. I fully acknowledge in the header the ASPN recipe as the origin of the threading solution. The pylab support in current ipython is basically this same idea, but generalized to work with either GTK or WX, and blended into the IPython code structure (that wasn't too bad, since ipython itself is based on code.py). Cheers, f |