WX and Boa Constructor

> I suggest you start with
>
[http://matplotlib.sourceforge.net/examples/embedding_in_wx2.py](http://matplotlib.sourceforge.net/examples/embedding_in_wx2.py)
and
> perturb off of that.  I can"t take a close look at your code right
> now, but this should get you started.
> > Cheers,
> JDH

Hi, and thanks for the reply.

The code was stripped out of embedding_in_wx.py; the version I have did not have embedding_in_wx2.py included… I upgraded to matplotlib-0.61.0.win32-py2.2

This (mostly) Boa generated code now does work similarly (no toolbar):

···

#Boa:Frame:wxFrame1

from wxPython.wx import *

from matplotlib.numerix import arange, sin, pi

import matplotlib

matplotlib.use(‘WX’)

from matplotlib.backends.backend_wx import FigureCanvasWx as FigureCanvas

#from matplotlib.backends.backend_wx import NavigationToolbar2Wx

from matplotlib.figure import Figure

from wxPython.wx import *

def create(parent):

return wxFrame1(parent)

[wxID_WXFRAME1] = map(lambda _init_ctrls: wxNewId(), range(1))

class wxFrame1(wxFrame):

def _init_ctrls(self, prnt):

    # generated method, don't edit

    wxFrame.__init__(self, id=wxID_WXFRAME1, name='', parent=prnt,

          pos=wxPoint(66, 66), size=wxSize(391, 312),

          style=wxDEFAULT_FRAME_STYLE, title='wxFrame1')

    self.SetClientSize(wxSize(383, 285))

def __init__(self, parent):

    self._init_ctrls(parent)

    self.SetBackgroundColour(wxNamedColor("WHITE"))

    self.figure = Figure()

    self.axes = self.figure.add_subplot(111)

    t = arange(0.0,3.0,0.01)

    s = sin(2*pi*t)

    self.axes.plot(t,s)

    self.canvas = FigureCanvas(self, -1, self.figure)

    self.sizer = wxBoxSizer(wxVERTICAL)

    self.sizer.Add(self.canvas, 1, wxLEFT | wxTOP | wxGROW)

    self.SetSizer(self.sizer)

    self.Fit()

def OnPaint(self, event):

    self.canvas.draw()

Ray

http://rjs.org