wx.lib.plot and sizers

I'm writing a lightweight instrument control utility in python (a
lightweight, less powerful replacement for labview). In order to hide
the GUI implementation from anyone writing new drivers for the
application I'm a collection of lightweight wrappers for commong
wxWidgets objects. My management classes take care of the dirty work
of keeping track of and creating those widgets and putting them on
panels. The eventual goal is to allow end users to create custom
panels with "controls" from various devices. Therefore it is
imperative that each wrapper is either an child of a wx.Widget or a
wx.Window. In order to easily incorporate them into custom panels.

Everything has been working perfectly with all regular wx controls.
(wrappers for sliders, lists, check boxes, and text controls work very
well), but I have run into a bit of a problem with
wx.lib.plot.PlotCanvas. It doesnt seem to work with sizers at all. I
guess the problem is because its a wx.Panel.

If I don't set a reasonable InitialSize, it just remains a small 1X1
white box on the panel. If I set an InitialSize, it doesnt scale with
the sizer, it moves when I stretch the window, which means the sizer
is aware of it, but it doesnt stretch with the sizer as you would
expect it to do.

Any suggestions on how to get a PlotCanvas to act like any other
widget or control?

Does it resize to the right size if you manually expand the size
of the frame? If so:

1. When you add the plot canvas to the sizer, make sure it has the
flag wx.EXPAND and the proportion = 1 (or whatever proportion you
want other than 0).

2. After it is added, be sure to call .Layout() on the panel or frame
that is its parent.

Example attached (with no graph shown, just a canvas)

Che

plotcanvas_sizer.py (1.83 KB)

ยทยทยท

On Mon, Sep 28, 2009 at 2:52 AM, crasic <trueurssian@gmail.com> wrote:

I'm writing a lightweight instrument control utility in python (a
lightweight, less powerful replacement for labview). In order to hide
the GUI implementation from anyone writing new drivers for the
application I'm a collection of lightweight wrappers for commong
wxWidgets objects. My management classes take care of the dirty work
of keeping track of and creating those widgets and putting them on
panels. The eventual goal is to allow end users to create custom
panels with "controls" from various devices. Therefore it is
imperative that each wrapper is either an child of a wx.Widget or a
wx.Window. In order to easily incorporate them into custom panels.

Everything has been working perfectly with all regular wx controls.
(wrappers for sliders, lists, check boxes, and text controls work very
well), but I have run into a bit of a problem with
wx.lib.plot.PlotCanvas. It doesnt seem to work with sizers at all. I
guess the problem is because its a wx.Panel.

If I don't set a reasonable InitialSize, it just remains a small 1X1
white box on the panel.