[wxPython-users] can a pyplot exist on a wxPanel or does it need to be in a wxFrame?

Christopher Barker Chris.Barker at noaa.gov
Wed Mar 7 16:38:37 PST 2007


C M wrote:
> That's good, but I'm having trouble doing it.  The documentation here =

> <http://www.wxpython.org/docs/api/wx.lib.plot.PlotCanvas-class.html> =

> says the __init__
> "Constructs a panel, which can be a child of a frame or any other =

> non-control window."
> I thought a wxPanel is considered a control, and so it shouldn't work to =

> place it on a panel?

No, a Panel is a Window, but it's not a Control. Indeed, the entire =

point of wx.Panel is to put other things on it.

> In any case, it doesn't work for me.  What I get is a tiny (32x32?) =

> square where the
> canvas ought to be and which appears to have the plot points scrunched =

> up in it.  I can
> set wxSize to whatever and the size of this plot is the same.  Attached =

> is the program
> showing the "tiny plot" problem.

I didn't see it at all on OS-X

> Any idea what I'm doing wrong?

You've got quite the jumble of multiple panels on there, and I got a bit =

confused.

1) read this:
http://wiki.wxpython.org/index.cgi/wxPython_Style_Guide

2) You don't need to make a Panel just to put the PlotCanvas on -- it's =

already a Panel. You can subclass it and add you custom code to it.

3) Absolute sizing and positioning is not the way to go with wxPython. =

In fact, it looks like your panel1 and panel2 overlap, which might have =

something to do with why I don't see the plot panel. Give Sizers a try =

-- you'll be glad you did.

In the meantime, here is enclosed a simpler version that might help get =

you started.


-Chris


-- =

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker at noaa.gov
-------------- next part --------------
A non-text attachment was scrubbed...
Name: testPlotApp.py
Type: text/x-python
Size: 2849 bytes
Desc: not available
Url : http://lists.wxwidgets.org/pipermail/wxpython-users/attachments/20070=
307/fbf772c8/testPlotApp.py


More information about the wxpython-users mailing list