Jeremy,
Thanks for fast response.
>
> I'm assuming that you're running from the console in the recommended
> way (i.e pythonw file.py -dWX).
Not really. I am mostly interested in interactive usage, hence I am
simply firing python or ipython from console, and then in python shell
issuing couple of commands like:
>>> from matplotlib.matlab import *
>>> plot((1,2,3))
> I am not surprised that you are having problems running the Wx backend
> from Idle and/or PythonWin. It is generally problematic to launch a
> GUI app from an application which uses a different GUI backend (e.g a
> Wx app from Idle (which is Tk)) as the event loops get in each others'
> way. There are a few things I have to fix in the window close code for
> Wx anyway (it's broken in some respects) - for the moment the
> recommended way is to use the 'close window' button.
Oh, I see. That explains it. I tried it from PyCrust and it does work
much better, though still there are some rough edges. Interactive mode
works, which is the most important one for me, but non-interactive does
not return back to python prompt after show() command, also cursor turns
into hourglasses when it is over plot window. Looks like there are still
some problems with message loop.
> However, I'm quite concerned that launching from the Windows console
> causes problems. It should work correctly, provided that python is on
> the path and WxPython is installed correctly in site-lib.
Yes, python is on the path, wxPython installed correctly in
site-packages. So what is the deal with "recommended way" of running
from console? pythonw will detach from console, but what -dWX do? It is
passed as an argument to script, so looks like it is responsibility of
the script to use it. Does that mean that WX backend can not be used
from regular console python shell? That would be quite unfortunate,
because for example IPython only runs interactively on console.
> I'd recommend boa-constructor (http://boa-constructor.sourceforge.net)
> for debugging Wx code. It's a pretty decent IDE, contains the best
> debugger I've yet found for Python, and is based on the Wx toolkit, so
> doesn't have the event loop issue mentioned above.
Last time I checked Boa, it was quite buggy. Maybe it is time to give it
a second try. Thanks for the pointer.
I am hoping someone familiar with TkAgg backend will step out and help
with Tk problems.
BTW, since decision which backend to use depends quite a lot on program
you are running matplotlib from, would it be possible to autodetect host
program and choose appropriate backend?
Thanks,
Kirill.
|