0

I'm writing a class to embed some common configurations of graphs in a wx Notebook tab, but I'm running into a strange issue. When I try to add wx.Panel with the FigureCanvas, instead it floats the figure in another window entirely.

example

The odd thing is, the graph window resizes when I resize the main window. The figure comes out the correct size, just not in the right window.

My code is here. I can't see what I'm doing wrong, I've embedded matplotlib in wx before, but never in a Notebook. I can get it to embed on a simple GUI by itself just fine, just not in the tabs.

bheklilr
  • 53,530
  • 6
  • 107
  • 163

1 Answers1

1

Try:

  1. Make GraphTab a wxPanel rather than a wxFrame
  2. Set all GraphTab to have nb as the parent (currently your first one has self as the parent.

I'm not sure whether this is everything, but it's a start.

tom10
  • 67,082
  • 10
  • 127
  • 137
  • It was the super class of `GraphTab`. I knew it had to be something simple, and to be honest I thought I already had it as a `Panel`, so I didn't think to look at that as the problem. As for the second point that was probably just a copy/paste error from when I was putting together the example for SO. Thanks – bheklilr Jan 04 '14 at 04:45