<br><br><div class="gmail_quote">On Sun, Jul 25, 2010 at 1:56 PM, Gael Varoquaux <span dir="ltr"><<a href="mailto:gael.varoquaux@normalesup.org">gael.varoquaux@normalesup.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">On Sun, Jul 25, 2010 at 10:35:02AM -1000, Eric Firing wrote:<br>
> Although ipython has provided invaluable service to mpl by enabling<br>
> interactive plotting for all gui backends, I am not at all sure that<br>
> this functionality should be left to ipython in the long run.  The<br>
> problem is that mpl is used in a variety of ways and environments.  Gui<br>
> functionality is central to mpl; it seems odd, and unnecessarily<br>
> complicated, to have to delegate part of that to an environment, or<br>
> shell, like ipython.<br>
<br>
</div>Wow, I just did a little experiment, and I really don't understand the<br>
outcome. Please bear with me:<br>
<br>
$ ipython<br>
<br>
In [1]: !cat /home/varoquau/.matplotlib/matplotlibrc<br>
backend     : GtkAgg<br>
<br>
In [2]: from pylab import *<br>
<br>
In [3]: ion()<br>
<br>
In [4]: plot([1,2,3])<br>
Out[4]: [<matplotlib.lines.Line2D object at 0xccb4dac>]<br>
<br>
In [5]: from enthought.mayavi import mlab<br>
<br>
In [6]: mlab.test_surf()<br>
Out[6]: <enthought.mayavi.modules.surface.Surface object at 0xd58ce0c><br>
<br>
Two things I do not understand:<br>
<br>
    1) I can interact alright with the Mayavi plot, nice and fine<br>
       eventhough there is not wx event-loop running, and I did not<br>
       register a InputHook<br>
<br></blockquote><div><br></div><div>This is because pygtk automagically and by default registers a PyOS_InputHook.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

    2) I did not get a segfault, while I am running at the same time GTK<br>
       and Wx. This used to be a big no no.<br>
<br></blockquote><div><br></div><div>The reason this works is that on Linux both GTK and Wx use the same underlying eventloop.  The same is true of qt4+wx on Mac.  As long as the underlying eventloop is iterated, events from both GUI toolkits can get handled.  But this is a very OS dependent trick.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
I believe that 1 is due to matplotlib registering an InputHook, but I<br>
cannot find where it is done. Also, does this seems to mean that under<br>
Linux GTK input hooks work for Wx (and they are nicer since they don't<br>
poll).<br>
<br></blockquote><div><br></div><div>Yes, you are right, the gtk inputhook does work for wx on Linux.  But that requires gtk to be installed to use wx.  But don't get used to this as this type of things won't work in the two process kernel.</div>
<div><br></div><div>Cheers,</div><div><br></div><div>Brian</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Anyhow, this is good news, eventhough I don't understand it at all.<br>
<div class="im"><br>
Gaël<br>
_______________________________________________<br>
IPython-dev mailing list<br>
<a href="mailto:IPython-dev@scipy.org">IPython-dev@scipy.org</a><br>
</div><div><div></div><div class="h5"><a href="http://mail.scipy.org/mailman/listinfo/ipython-dev" target="_blank">http://mail.scipy.org/mailman/listinfo/ipython-dev</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Brian E. Granger, Ph.D.<br>Assistant Professor of Physics<br>Cal Poly State University, San Luis Obispo<br><a href="mailto:bgranger@calpoly.edu">bgranger@calpoly.edu</a><br>
<a href="mailto:ellisonbg@gmail.com">ellisonbg@gmail.com</a><br>