Nested FoldPanelBars

I’m hoping to build a very long panel based on nested
FoldPanelBars, and I’ve run into a couple of issues,

one of them I can probably deal with, but the other I could
at least use a pointer to what is causing the

problem.

[ You might say, “why are you nesting FoldPanelBars?”
but for this application, it would be ideal. The

stuff between the caption bars is mostly groups of sliders
and SpinCtrls, so a tree wouldn’t work well,

and I really need to be able to hide most of the controls
while still being able to see the hierarchy which

leads to the un-hidden ones. Also, this whole panel
(including hierarchy) is generated on-the-fly from an

external description, so I can’t easily break the
thing up into a 2-dimensional grouping, which would

be more reasonable for a set of fixed controls. ]

The first problem is that FoldPanelBars, it seems, are meant
to be created with a fixed size, or to resize

themselves according to the containing frame, rather than
resizing themselves to fit the contents. Whenever I create

a bar, I have to Fit() all of its subpanels, and then find
the size of the whole thing, so that it’s only big

enough to contain its subpanels. That doesn’t seem to
be available as a built-in function, maybe I missed

it. That’s not really a problem; the bigger issue is
that when you collapse panels in a nested FoldPanelBar,

the FPB itself needs to get smaller so that the panel of the
containing FPB can get smaller; otherwise,

you’re not saving space by collapsing inner panels.
Likewise the containing FPB needs to get smaller

so that panels below it can move up (and all get bigger when
things are expanded).

I imagine there’s a way to this using all the
internal sizing events in the FPB, but I would appreciate some pointers.

The other issue is this: when I expand an inner panel, all
containing panels are collapsed! When you expand

the containing panel(s), you can see that the inner panel
is now expanded. This means that, after expanding a

n-level deep panel, you need about (2^n)-1 more clicks before
you can see it. I’ve no idea what’s happening here,

again, any help would be appreciated.

Sorry about the disclaimer below. The intended recipient is anyone
even vaguely interested in wxPython.