On Fri, Jul 18, 2008 at 07:57:25PM +0200, Gael Varoquaux wrote: > OK, now what is the way forward. We need to provide the advanced-user for > a good control on the backend. We need to provide a way that simply works > without changing anything. The same code should run in "ipython -pylab", > idle, or SPE. I think this means we need to add an rc entry. We could > have two entries for backends:
> backend: auto or any of the current existing > backend-default: any of the current existing > If backend is set to auto, pyplot would check if an event loop is running > and select the appriopriate backend. If no eventloop is running, it would > use the backend specified in backend-default. > This should work fairly nicely. The only think I am worried about is > people changing the backend using matlplotlib.use, while rc['backend'] is > still at auto, and then importing pyplot, which would change again the > backend. Any suggestion for how to address that? Maybe matploib.use could > put a flag somewhere, saying that it has been explicitely called. > Internallythe plyplot magic to choose the backend would not set this > flag. I talk to Fernando about this, and he came up with a suggestion I like quite a lot. The idea would be to give an "backend_fallback" boolean in the rc parameters. When loading an interactive backend, if this boolean is set to true (by default), the backend-loading code would check that the proposed interactive backend is complatible with the current running mainloop, and if not walk the different backends to find a suitable one, without shooting a warning at the user, because the user should not have to know about this. I think this is a good way of satisfying both the requirement for seemless operation in different event loops and the requirement for advanced users that can control completely how things happen using the rc parameter switch. Moreover, if there is not risk of conflict, the rc-specified choice would be kept. What do you think? Where should I insert this code? Cheers, Gaƫl ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel