Louis Pecora wrote:

BUT. (Users are never satisfied are they/we? :-) ). My ultimate goal is to not wait until the end of the script to do the plot, but to be able to plot and keep the script running. This can be done either by pausing the script (in some way) or by leaving the matplotwindow open and continuing with the script.

The problem here is the interaction between the event loops of the terminal and whatever GUI toolkit matplotlib is using. For instance, with wx, when you call show(), matpotlib brings up a wx Window, then the wx Event loop is called, and blocks all control. You might try using ipython (http://ipython.scipy.org/) a fair bit of work has been put into making it work well with matplotlib. However, it doesn't sound like what you want is truly interactive.


If I understand, what you're looking for is a way to write a procedural script that pops up a dialog box now and again to ask a question, and creates, shows, and destroys plot windows as it needs to. Have I got that right?

The problem you're running into is that GUI toolkit use an event-driven model, rather than a procedural one. Once the event loop is stated, the script halts there. A few years back I was trying to do that same thing. I'm not sure why, but I don't feel the need for it anymore. Perhaps it's because I'm used to wxPython now, and just write a full event driven app when I need one.

Clicking the close button on the matplotlib window crashes Python.

hmm. I don't think that should happen.

I am running from a terminal window for now using Pythonw since I also use EasyDialogs.

Here's a trick: EasyDialogs used Carbon (I think). In general, things get messy when you mix GUI toolkits. I think you're going to need to go to writing your dialogs in the same toolkit as matplotlib is using. It's too bad that no one has written a PyObjC back-end for matplotlib, as that would probably be the best option on OS-X. However, wxPython and/or Tkinter should work. I'd have to probe the mailing lists, but I think some one wrote a little code to make it easy to write procedural apps with using wx dialog boxes, and adding matplotlib to that mix should be easy from there. I'm interested in helping out if you want to go that route.



I've played with matplotlibrc setting "interactive" to True, but that did nothing.

What that setting does is set the back-end to re-draw whenever you change something in the plot, rather than waiting for a show() call.


And I have to say your binary and the wxPython binary were trivial to install and get running.

glad to here it, they should be.

-Chris


-- Christopher Barker, Ph.D. Oceanographer NOAA/OR&R/HAZMAT (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception

[EMAIL PROTECTED]
_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig

Reply via email to