Alexander Lamaison wrote: > I would like it to work > is to use the default backend if X is available and, otherwise, fall > back to using the Agg backend. How can I do this?
I had a similar need a good while back with wxPython. I found some C code on the net that tries to connect to an X server and fails gracefully if it can't. I also wrote a Python wrapper around it. I haven't used it for years, and can't even find it on my machine, but thanks to the glory of archives and google, here it is: http://osdir.com/ml/python.wxpython/2004-03/msg00294.html You'd use it like: import matplotlib import isX if isX.isX: matplotlib.use("wxGTK") or whatever.. else: matplotlib.use("AGG") note that you can also just check and see if the "DISPLAY" environment variable is set, but that won't be as reliable. However, as the whole user interaction has to be totally different, I wonder if you can't just have a different start-up script depending on whether they want to run the GUI version or not. -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception chris.bar...@noaa.gov ------------------------------------------------------------------------------ Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT is a gathering of tech-side developers & brand creativity professionals. Meet the minds behind Google Creative Lab, Visual Complexity, Processing, & iPhoneDevCamp as they present alongside digital heavyweights like Barbarian Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/creativitycat-com _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users