On Sat, Jul 19, 2008 at 1:05 AM, Gael Varoquaux <[EMAIL PROTECTED]> wrote:
> It turns out it was only in the GTK backend, and quite trivial to > correct. Attached is a new patch, including this correction. Hey Gael, this is starting to look reasonable. I know implementing these checks, such as detecting whether the mainloop is active, can be a hassle, so thanks for taking the time to write against so many environments. We may want to make take the logic you've provided and encapsulate them in the backend methods to make them more easily recognizable, fixable and reusable. Eg, each unser interface backend would provide a "mainloop_running" method. You could then access this in pyplot to support your fallback logic, and also we could use it in "show" to make sure we don't try and start mainloops that are already running. One thing notice in your patch is that when it comes time to check for tk, you import tkinter and then do nothing with it. I assume this is a placeholder until you figure out what you want to do? For a little background, Fernando, Gael and I talked about this problem a bit over the phone yesterday. The use case they are trying to address is that people may be wanting to use more than one application, at different times or at the same time, that have embedded python shells. With all the work going on making ipython frontends for wx, qt and gtk, it is not unreasonable to assume that there ill soon be multiple IDEs or other environment in which one might want to import and use pylab. Since we only support one default backend, and it is dificult and onerous for the user to constantly modify their rc depending on what application they may be launching, Fernando and Gael proposed supporting a backend fallback option so the user could express the intention: use my default backend unless I happen to be in an incompatible user interface environment and then just choose the most sensible thing. Users who do not want this magic can simply turn the fallback option off. This behavior will only be triggered if 1) the fallback option is on (it will be by default) 2) the user is running mpl in an environment in which a user interface already has a running mainloop 3) the default backend is known to be incompatible. Eg, if the default backend is PS, nothing will happen. I think the proposed changes are reasonable. JDH ------------------------------------------------------------------------- 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