> I've been trying to use matplotlib from boa constructor (on windows,
> running enthon-python2.4-1.0.0 and boa-constructor 0.4.4). For test
> purpose I have a single button-event call this function:
>
> def testPlot():
>         plot([1,2,3])
>         show()
>
> Everything is fine for the first event -  button fires the function and
> a plot-window is showing. Killing this window and have a second go at
> the plot at first seems to work but the window can not be closed and
> when I try to move said window the whole application crash.

There is a conflict between the GUI library used by boa constructor
(wxWidgets/wxPython) and the one used by default by matplotlib when
you run the show() command (Tk).

Each of these two libraries run an event loop, handling all your
keyboard and mouse inputs. When you start your application, wxWidgets
has control. When you run show(), Tk takes control and displays your
matplotlib chart. But when you close the chart window, Tk keeps
control, so your application freezes.

The solution is to use another backend, compatible with wxpython. Try
backend WX or WXAgg.

At the top of your script (before import pylab), add this:
import matplotlib
matplotlib.use('WX')

or:
import matplotlib
matplotlib.use('WXAgg')

More explanations here: http://matplotlib.sourceforge.net/backends.html

For reference, here is information provided on  matplotlib's web site:
http://matplotlib.sourceforge.net/installing.html
There are known conflicts with some of the backends with some python
IDEs such as pycrust, idle. If you want to use matplotlib from an IDE,
please consult backends for compatibility information. You will have
the greatest likelihood of success if you run the examples from the
command shell or by double clicking on them, rather than from an IDE.
If you are interactively generating plots, your best bet is TkAgg from
the standard python shell or ipython.

Good luck!

-- Nicolas Grilly

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to