From: Fernando P. <Fer...@co...> - 2004-08-19 17:06:06
|
John Hunter wrote: >>>>>>"Fernando" == Fernando Perez <Fer...@co...> writes: > Fernando> ps. John, I think we almost have this nailed :) > > Don't tempt the fates -- I got an X11 freeze. But I think I fixed it. Hey, I said _almost_ :) > def pre_interact(self): > """Initialize matplotlib before user interaction begins""" > > ---> import matplotlib.matlab > > I don't think you want this, especially not here. Remember that all > the matplotlib.use and matplotlib.interactive calls should be made > *before* importing matplotlib.matlab (which is when the actual backend > is imported) Noted. > push = self.shell.push > # Code to execute in user's namespace > lines = ["import matplotlib", > ---> "matplotlib.use('GTKAgg')", > "matplotlib.interactive(1)", > "import matplotlib.matlab as matlab", > "from matplotlib.matlab import *"] > > You might make the additional caveat in the docs about honoring rc > settings that the default backend is overridden. Well, actually I think we should honor the user's rc choice, don't you? In fact, the ipython version does this, so the equivalent here would be just to comment out the line you highlighted. > > map(push,lines) > > # turn off rendering until end of script > ---> matplotlib.matlab.interactive = 0 > > I'm pretty sure you mean matplotlib.interactive(0) -- ie, it's a > function, not a variable, and it isn't in the matlab interface module. > And don't you want to turn off interaction only if they load a file, > and then turn it back on? Ie, [...] Ok. In fact, in the ipython-based version you and I have floated, this was alreadey fixed (by you). But I'll double-check as soon as I can get that done (probably this evening). I asked the pygtk crowd for help with the simpler pyint-gtk, which did NOT have our recent work, because it made it much easier for them to test without asking them to download CVS ipython. > But with these changes, it works great! Here is my modified version Cool. I'll integrate Antoon's and your fixes into the 'real' (read ipython-based) code, and we'll play with that a bit. Do you foresee any problems with the WX backend? Right now I have global pygtk calls, but I suppose those should be done only by the matplotlib shell class IF Gtk is the chosen backend. That part of the design needs a bit of polishing, and I may have to leave it til we meet at scipy'04. I still have to put my talks together for the meeting, so my hacking time will be very limited for the next two weeks. But we _are_ close :) Best, f |