wxList and FigureCanvasWx

Hello -

I’'ve got a wxDialog where, among other
controls, I have a wxList and a FigureCanvasWx. Depending on what single item
is selected in the wxList, the FigureCanvasWx should show the appropriate
graph. It’s important that the matplotlib-generated graph stay in the dialog
along with the other controls (I don’t want to generate a separate frame
for the graph).

I don’t want to have to recompute the graph using matplotlib
to refresh the FigureCanvasWx if the user selects a different item in the List.
Is there a way to generate the graphs, temporarily store the figures (without
having to write them to the hard drive using savefig), and show the
appropriate graph based upon the List selection?

I thought about generating and saving the graphs to disk and
then loading them in and using them as bitmaps in the wxDialog when needed -
however, that doesn’t seem very efficient as the program would have to
access the disk and load the bitmap every time the list selection changed.

If it helps, here’s part of the code used in creating
the FigureCanvasWx:

def init(self, parent):

    self._init_ctrls(parent)

Create all other dialog controls

    self.fig = Figure((4.7,4),
    self.canvas = FigureCanvasWx(self,

-1, self.fig)

    self.canvas.SetPosition(wxPoint(480,400))

Thanks in advance,

Dave Engelsma

Lacks Wheel Trim Systems

···