I think my default TkInter backend (tuned for use with IDLE) is not
really compatible with the Qt threads. How can I change the backend
for matplotlib when using spyder without changing my default
matplotlib rc file?
I'm working with matplotlib 0.99.1, so maybe things are different with
a more recent matplotlib.
Essentially, at least since early in the spyder 1.x series if I have a
matplotlib show() in my script then the external consoles show the
graphs. After closing the graphs I get the prompt in the shell but
when I hit enter after entering a python command it just goes to the
next line without ever executing the python command or showing any
results. When I run the script containing the plots in the ipython
shell, I got
"
In [5]: plt.show()
In [6]: Fatal Python error: PyEval_RestoreThread: NULL tstate
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
Fatal Python error: PyEval_RestoreThread: NULL tstate
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
"
In the 1.x series I could still use the internal shell, where the
interaction after plt.show() still worked.
WindowsXP, spyder 2 beta4
Thanks,
Josef
I found that my comparable printing issues were resolved when using
the Qt4Agg backend in matplotlib (using matplotlib 0.99.1.1).
After importing matplotlib but BEFORE pylab, change the backend like this:
matplotlib.use('Qt4Agg', warn=True)
I believe the default one is:
matplotlib.use('GTKCairo', warn=True)
For more info about the backends:
http://matplotlib.sourceforge.net/faq/installing_faq.html#what-is-a-backend
The reason why I was looking for changing the backend, is the warning
in matplotlib when using the default GTKCairo. Using spyder 1.1.0, I
get:
/usr/local/lib/python2.6/dist-packages/matplotlib-0.99.1.1-py2.6-linux-x86_64.egg/matplotlib/backends/backend_gtk.py:621:
DeprecationWarning: Use the new widget gtk.Tooltip
self.tooltips = gtk.Tooltips()
For spyder 2.0.0beta4 an additional message is given:
/usr/lib/pymodules/python2.6/gtk-2.0/gtk/__init__.py:127:
RuntimeWarning: PyOS_InputHook is not available for interactive use of
PyGTK
set_interactive(1)
Personally, I never work with the show() command. I always save my
figures using savefig() (often in .eps, works fantastic when using my
figures together with LaTeX) close them with close() and view them in
other viewer. This works very well for my usual scenario's where a lot
of plots are generated and saved automatically.
Since this is my first post on the mailing list, I would like to take
the opportunity to thank especially Pierre for his great work on
Spyder!!
Greetings,
David
> --
> You received this message because you are subscribed to the Google Groups "spyder" group.
> To post to this group, send email to spyd...@googlegroups.com.
> To unsubscribe from this group, send email to spyderlib+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/spyderlib?hl=en.
>
>
Thanks, that works.
I never thought of choosing the backend inside the script. Now it
would be interesting to do this only if I (or someone else) is using
spyder, but I haven't found yet what condition to put in the if.
Josef