Nested sizer removal confusion (SOLVED)

OK, responding to myself for the archives:

The problem seemed to be the presence of windows in the nested sizer.
Running a "target.DeleteWindows()" where target is the wx.SizerItem in
question before running the mainSizer.Remove(targetId) made the whole
thing work as expected.

···

-----Original Message-----
From: Anthony M. Floyd
Sent: April 24, 2007 5:08 PM
To: wxpython-users@lists.wxwidgets.org
Subject: [wxPython-users] Nested sizer removal confusion

Hi All,

I've tried to work my head around removing a boxsizer that's
nested in another sizer, but for the life of me, I'm just not
seeing clearly.

What I want to achieve is to first create a "list" of
controls in horizontal box sizers nested in a parent vertical
box sizer (not a problem). At some arbitrary time in the
future, the user clicks a button in one of those horizontal
box sizers, and that "row" gets removed.

I can't get this to work. I've searched through the
archives, but most of what I turned up was from the Python
2.2 days. I've attached some sample code ... Warning, it's
pretty verbose at the moment, dumping lots of stuff to stderr
so that I can see what is where. To see my problem, click
"Button 2" in the example. You'll notice that button 3
disappears but things have tanked: the parent sizer still
seems to think it has 3 nested sizers -- until I click button
2 again, in which case the debug shows me that it has only
buttons 1 & 3, yet displays 1 & 2. Oy, much confusion.

I've tried it both using Python 2.4.3 (Enthought) with wx
2.6.1.0 as well as Python 2.5.1 (stock) with wx 2.8.3.0 both on Win32.

Any suggestions?

Thanks,
Anthony.

--
Anthony Floyd, PhD
Convergent Manufacturing Technologies Inc.
6190 Agronomy Rd, Suite 403
Vancouver BC V6T 1Z3
CANADA

Email: Anthony.Floyd@convergent.ca | Tel: 604-822-9682
WWW: http://www.convergent.ca | Fax: 604-822-9659

CMT is hiring: See http://www.convergent.ca for details