Detach method of sizers

I'm having trouble making a dynamic dialog where certain widgets are transfered between different sizers. In the wxWindows documentation of the wxSizer object it looks like I should be able to use the Detach method to remove an object from a sizer without having it deleted, but when I go to use the method it doesn't appear to exist:

File "/focus/fwb/src/lib/fracview/fracview.py", line 118, in ReLayout
     s.msizer.Detach(s.sizer)
AttributeError: wxBoxSizer instance has no attribute 'Detach'

I need to be able to detach these objects because the constructors take a long time so I can't just make new ones. Is there some other way to not have objects deleted when the sizer they are contained in is deleted that I have missed? Thanks,

Andrew

Andrew Jones wrote:

I need to be able to detach these objects because the constructors take
a long time so I can't just make new ones. Is there some other way to
not have objects deleted when the sizer they are contained in is deleted
that I have missed? Thanks,

I think you want:

Sizer.Remove(Window)

From the docs:

Removes a child from the sizer. window is the window to be removed,
sizer is the equivalent sizer and nth is the position of the child in
the sizer, typically 0 for the first item. This method does not cause
any layout or resizing to take place and does not delete the window
itself. Call wxSizer::Layout to update the layout "on screen" after
removing a child from the sizer.

Returns TRUE if the child item was found and removed, FALSE otherwise.

-Chris

-- --
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

Andrew Jones wrote:

I'm having trouble making a dynamic dialog where certain widgets are transfered between different sizers. In the wxWindows documentation of the wxSizer object it looks like I should be able to use the Detach method to remove an object from a sizer without having it deleted, but when I go to use the method it doesn't appear to exist:

File "/focus/fwb/src/lib/fracview/fracview.py", line 118, in ReLayout
    s.msizer.Detach(s.sizer)
AttributeError: wxBoxSizer instance has no attribute 'Detach'

You are looking at the docs for 2.5.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!