On 2013/10/11 7:36 AM, Federico Ariza wrote:
> Ok,
> for me embedding is more of using the canvas directly and putting
> inside my own window.
> But OK, i give you that.
>
> In that case,
> if I have standalone funcion (or class) that can be run alone something like
> do_my_plots().... that if run with python myplots.py will display the plots.
>
> How can I add the do_my_plots call to my Gk3 app? and not having to
> worry that closing the plot windows will close my gtk3 app?

I think the choices are to rewrite do_my_plots to be consistent with 
your embedding, or to run it in a separate process.  For the former 
option, the key is to keep pyplot out of everything except a top layer 
which is used when calling via script or in a pyplot environment (e.g. 
ipython), but which is not used in your gtk3 app.  As an example (sorry 
it is rather long and complex) see 
http://currents.soest.hawaii.edu/hg/pycurrents/file/43a9236c62ff/plot/txyselect.py.
 
  Note that pyplot is not even imported except inside a function that is 
used to demonstrate the functionality in script mode.  Therefore all the 
functionality is accessible when embedding by importing the module, so 
long as one does not call that one highest-level function.  To embed, 
one simply includes the contents of that function but without the pyplot 
parts.

Eric

>
> Federico
>
> On Fri, Oct 11, 2013 at 1:32 PM, Eric Firing <efir...@hawaii.edu> wrote:
>> On 2013/10/11 7:12 AM, Federico Ariza wrote:
>>> I am not embedding, just launching, as the example shows.
>>
>> No, your example shows that you *are* embedding.  You are running your
>> own Gtk.main().  That's embedding.
>>
>> ------------------------------------------------------------------------------
>> October Webinars: Code for Performance
>> Free Intel webinars can help you accelerate application performance.
>> Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from
>> the latest Intel processors and coprocessors. See abstracts and register >
>> http://pubads.g.doubleclick.net/gampad/clk?id=60134071&iu=/4140/ostg.clktrk
>> _______________________________________________
>> Matplotlib-devel mailing list
>> Matplotlib-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
>
>
>


------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60134071&iu=/4140/ostg.clktrk
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

Reply via email to