Dyna grids and components - how ?

I am not sure how you want this to look. So I can't say exactly what you
should do. However, in general I think you need a better understanding of
sizers in wxWindows/wxPython. This is a difficulty that everyone must face
when beginning to use this package.

For example, you may need to put a sizer *inside* your panel -- in order to
correctly size what you want to appear there (such as a grid). Probably
the best way to do this is to define your own class which is subclassed
from wxPanel and create your sizer(s) in it with methods that also will
then place things within those sizers.

The way you have things now, you have created a panel and made your buttons
children of the panel, but there is no sizer in the panel to control sizing
of its children. The only sizer you have is an "outer" sizer that is
sizing the entire panel. The buttons are children of the panel, but you
are "controlling" their sizes and layout with the outer sizer that is
really controlling the panel they are within -- -- or at least this is how
it looks to me.

If you want the buttons to be *in* the panel, then you should have a sizer
*in* the panel that will handle the buttons (and anything else in the panel
(in fact you may want several sizers, depending on how complex the contents
of teh panel will be). If you want the buttons *outside* the panel, then
you should not make them *children of* the panel.

If possible, I would recommend that you get wxDesigner if you can afford
the minor expense. While it has shortcomings, I think it is the best way
to quickly learn how sizers actually work and the effect that the various
parameter values have. Also, look carefully at the demos that come with
wxPython, concentrating on those involving buttons, panels, and their
relations to the sizers that control them.

···

--------------------------------------
Gary H. Merrill
Director and Principal Scientist, New Applications
Data Exploration Sciences
GlaxoSmithKline Inc.
(919) 483-8456

For example, you may need to put a sizer *inside* your panel -- in order to
correctly size what you want to appear there (such as a grid).

Actually, he did do this:

self.panel.SetSizer(self.sizer)

That line of code is in the frame's constructor, which may not be the
best code structure, but it works.

Probably
the best way to do this is to define your own class which is subclassed
from wxPanel

Probably, depending on what the ultimate goal is. In fact, in this
example, I don't thin kthe panel does anything useful, but I'm assuming
this is only a test bed to figure out how do do this kind of thing.

The way you have things now, you have created a panel and made your buttons
children of the panel, but there is no sizer in the panel to control sizing
of its children. The only sizer you have is an "outer" sizer that is
sizing the entire panel.

Again, look at the SetSiser call...that's where a Sizer is assigned to a
window.

See my last post for a example that does what I think he asked for.

Also, look carefully at the demos that come with
wxPython, concentrating on those involving buttons, panels, and their
relations to the sizers that control them.

good advise. This reminds me... I really want to add a whole bunch of
comments and do some renaming of the Sizer demo..it could be a whole lot
more useful. Has anyone started that?

-Chris

···

gary.h.merrill@gsk.com wrote:

--
Christopher Barker, Ph.D.
Oceanographer
                                        
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@noaa.gov