On Nov 27, 2007 12:10 PM, J.D. Herron <[EMAIL PROTECTED]> wrote:
>
>
> Hello,
>
> I'm using boost python to run python embedded in a C++ application on
> windows.  I would like to be able to have the scripts that run in this
> embedded environment be able to display matplotlib plots.  I have searched
> in vain for information on the nuances of running matplotlib pylab plots in
> an embedded c++ environment and am hoping someone can help me out.

Alexander Schmolck reported similar problems trying to call pylab from
an embedded app.  My response to him at the time was:

  > Eeeeew, that looks really dangerous.  For starters, I would never try
  > to do this using pylab, but rather follow the lead of
  > examples/embedding_in_qt.py.  Then you won't be competing for the
  > mainloop....

I CCd him on this email.  Perhaps he has made some progress since his
original attempts and can advise...

JDH


> My C++ application has an event handler to run a python script when the user
> so chooses.  From this main message thread I execute a script file (using
> boost::python::exec_file() ) and if that script does a pylab plot of data
> the first time through everything works fine.  An example script would be
> something like:
>
> fig = pylab.figure()
> pylab.imshow( myImage )
> pylab.show()
>
> I am able to interact with the plot window just fine and close it from the
> upper right window controls.  However, if I run the same script again from
> my app the figure window comes up with my data but the window is now dead.
> I am unable to interact or even close the figure window.  When I try to move
> the window my app crashes.
>
> I want the plotting to behave synchronously so that control is not returned
> to my app until the plot is dismissed.  However, after the first show it
> seems that interactivity is automatically enabled for matplotlib.  I've
> tried explicitly turning interactivity off in the script ( pylab.ioff() )
> but show seems to automatically turn it back on.
>
> I'm just not sure of all I need to do to get this working so that I can
> bring up the plot over and over.  BTW I've configured my matplotlib with a
> wxAgg backend.  Can anyone help me out here or point me to information on
> embedding matplotlib in c++?  Thanks in advanceā€¦.
>
> J.D.
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2005.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>

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

Reply via email to