two questions

Is there a reason that for the GTK backend

    > gtk.DrawingArea was used instead of gtk.Layout? As far as
    > I can tell gtk.Layout can do everything that
    > gtk.DrawingArea can, but has the additional advantage
    > that you can place widgets on the canvas, which can be
    > extremely useful. I tried a quick patch (which I can send
    > if anyone wants), where I got it working fine. The main
    > changes (there aren't many) are where changes to the
    > window would be make, 'self.window' needs to be replaced
    > with 'self.bin_window', and I also found I had to connect
    > to the 'size-allocate' event to have it properly
    > redrawwhen the window size changed.

    > As a side note, one feature that this might allow, would
    > be to allow for matplotlib-widgets to be drawn using the
    > GTK if the backend were detected (much like how SWT, for
    > Eclipse works).

This sounds useful -- could you post a patch against CVS on the
sourceforge site (and email here when it is up) so we can test it.
I think the only reason that this wasn't used initially was ignorance
on my part. I was hoping I could blame version numbers, that this
wasn't available in pygtk 1.99.16 when mpl was released, but on quick
inspection this explanation does not appear to hold water.

    > Also, on a complete tanget, does anyone know of a good
    > method of saving animations done in MPL? The only two
    > methods that I can think of right now are to (1)
    > interface with matlab, or (2) save each frame, and create
    > an animated gif. As my movies are fairly large, neither
    > seem like a great option.

    > After searching around some, I found pymedia, but when I
    > try to import it, all it manages to do is crash. While a
    > SWIG interface could be created for FFMPEG, it would be
    > nice if there were some other option.

Something like this could usefully be placed in a toolkit following
the basemap model, where adding an extra layer of extension code
doesn't pose any installation or distribution woes for the core. I
think it would be useful.

In the meantime, I typically save a series of PNGs and convert them to
MPEG using image magick's "convert" or mencoder.

  http://matplotlib.sourceforge.net/faq.html#MOVIE

See also examples/movie_demo.py.

If you come up with other/better alternatives, let us know.

JDH

Okay, here's the patch. I'm also including a quick demo with a button that gets added directly to the canvas.

On a side note, I can't get the CVS version to work under ipython, and get this error (it was working fine with 0.83.2):

layout_patch (3.01 KB)

mpl_gtk_widget.py (194 Bytes)

···

---------------------------------------------------------------------------
exceptions.SystemError Traceback (most recent call last)

SystemError: Objects/moduleobject.c:48: bad argument to internal function
Segmentation fault

Abe

John Hunter wrote:

"Abraham" == Abraham Schneider <abes@...137...> writes:
           
   > Is there a reason that for the GTK backend
   > gtk.DrawingArea was used instead of gtk.Layout? As far as
   > I can tell gtk.Layout can do everything that
   > gtk.DrawingArea can, but has the additional advantage
   > that you can place widgets on the canvas, which can be
   > extremely useful. I tried a quick patch (which I can send
   > if anyone wants), where I got it working fine. The main
   > changes (there aren't many) are where changes to the
   > window would be make, 'self.window' needs to be replaced
   > with 'self.bin_window', and I also found I had to connect
   > to the 'size-allocate' event to have it properly
   > redrawwhen the window size changed.

   > As a side note, one feature that this might allow, would
   > be to allow for matplotlib-widgets to be drawn using the
   > GTK if the backend were detected (much like how SWT, for
   > Eclipse works).

This sounds useful -- could you post a patch against CVS on the
sourceforge site (and email here when it is up) so we can test it.
I think the only reason that this wasn't used initially was ignorance
on my part. I was hoping I could blame version numbers, that this
wasn't available in pygtk 1.99.16 when mpl was released, but on quick
inspection this explanation does not appear to hold water.

   > Also, on a complete tanget, does anyone know of a good
   > method of saving animations done in MPL? The only two
   > methods that I can think of right now are to (1)
   > interface with matlab, or (2) save each frame, and create
   > an animated gif. As my movies are fairly large, neither
   > seem like a great option.

   > After searching around some, I found pymedia, but when I
   > try to import it, all it manages to do is crash. While a
   > SWIG interface could be created for FFMPEG, it would be
   > nice if there were some other option.

Something like this could usefully be placed in a toolkit following
the basemap model, where adding an extra layer of extension code
doesn't pose any installation or distribution woes for the core. I
think it would be useful.

In the meantime, I typically save a series of PNGs and convert them to
MPEG using image magick's "convert" or mencoder.

http://matplotlib.sourceforge.net/faq.html#MOVIE

See also examples/movie_demo.py.

If you come up with other/better alternatives, let us know.

JDH

-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel