Hi Brian,

On 26.08.2009, at 17:01, Brian D'Urso wrote:

> I am new to plplot, and I would like to embed it in a wxpython (python
> + wxwidgets) application, within a window my app has created. I want
> to try to use plplot for semi-real-time plotting (updated up to ~ 10
> times per second) on Linux and windows, so I'm looking for a fast and
> portable approach. I will also eventually need something like double
> buffering to avoid flickering.
>
> It seems like the obvious approach would be to use the plplot python
> bindings and the wxwidgets driver, but I don't see a way to control
> the creation of the plot window from python. Perhaps an alternative
> would be to use the mem.c driver, and display the resulting plot image
> in wxpython.
>
> Can you advise me on the fastest and most flexible (cross-platform)
> approach with plplot before I start going in the wrong direction? I'm
> open to writing a little code if needed.

I think the simplest aproach is to "port" the wxWidgets bindings  
(bindings/wxWidgets) to wxpython. Have a look at wxPLplotstream.cpp.  
In the constructor I call the method Create(), where I set up the  
plplot library for plotting into a wxMemoryDC. So basically you neet

plsdev("wxwidgets");
plinit();
plcmd( PLESC_DEVINIT, (void*)m_dc );

The last command tells the wxWidgets driver were to plot into. That's  
it. This is also then flicker free since you need to copy the bitmap  
of the wxMemoryDC to the screen (which is basically double buffering).  
See the rest of the wxPLplotstream.cpp file. You don't need the  
wxPLplotwindow.cpp, which provides just a convience canvas for easier  
use. So all you need is to "port" wxPLplotstream.cpp to Python and  
you're done.

Regards,
Werner

>
> Thanks,
> Brian
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008  
> 30-Day
> trial. Simplify your report design, integration and deployment - and  
> focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> _______________________________________________
> Plplot-general mailing list
> Plplot-general@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/plplot-general

--
Dr. Werner Smekal
Institut fuer Allgemeine Physik
Technische Universitaet Wien
Wiedner Hauptstr 8-10
A-1040 Wien
Austria

email: sme...@iap.tuwien.ac.at
web: http://www.iap.tuwien.ac.at/~smekal
phone: +43-(0)1-58801-13463 (office), +43-(0)1-58801-13469 (laboratory)
fax: +43-(0)1-58801-13499


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Plplot-general mailing list
Plplot-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-general

Reply via email to