On Thu, Feb 21, 2008 at 3:07 PM, Kevin Milner <[EMAIL PROTECTED]> wrote:
> Hi everyone,
>
>  I am a developer on a PyGTK application for Earth Science research and
>  education called SEATREE ( http://geosys.usc.edu/projects/seatree/wiki )
>  and we are trying to integrate some pylab plots.
>
>  I can successfully create and use a pylab frame/window inside of our GTK
>  application using the following sequence (note that all of this is
>  called AFTER the application has launched and the GTK main loop has
>  started):
>
>  -------------------------------------
>  import math
>  import pylab as p
>  import matplotlib
>  from matplotlib.backends.backend_gtk import FigureCanvasGTK,
>  NavigationToolbar
>  matplotlib.use('GTK')

For the "use" directive to be honored, it must be called before you
import pylab.  If it is after, as in your example code, pylab will
respect the setting in your matplotlibrc file -- see
http://matplotlib.sf.net/matplotlibrc (this is likely why you are
getting unexplained references to tk code).

But you should not be using pylab, since you are embedding mpl in a
GTK GUI.  Instead, you should be using the matplotlob API,
specifically the idioms for embedding mpl in gtk -- it takes a little
more work up front but it is the only acceptable way to use mpl in a
GTK app

http://matplotlib.sf.net/examples/embedding_in_gtk.py
http://matplotlib.sourceforge.net/examples/embedding_in_gtk2.py

See also the OO FAQ and the API tutorial for more insight into using
the API directly rather than the pylab interface

http://matplotlib.sf.net/faq.html#OO
http://matplotlib.sf.net/leftwich_tut.txt

JDH

JDH

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to