wx.Sizer.Remove(). upgrade python2 to python3


I am upgrading a python2 (wx version: script to python3 (wx version: 4.0.7)

Program chokes at

#arg# is a wx.ToggleButton derived object. Error message is “TypeError: Sizer.Remove(): arguments did not match any overloaded call:”

It looks like that .Remove syntax has changed. What is the best (easiest) way to resolve this?

thanks in advance

++ help script follows ++

With python3 help(wx.Sizer.Remove) reads:
Help on built-in function Remove:

Remove(sizer) -> bool
Remove(index) -> bool

Removes a sizer child from the sizer and destroys it.

With python2:
Help on method Remove in module wx._core:

Remove(*args, **kwargs) unbound wx._core.Sizer method
Remove(self, item) -> bool

Removes an item from the sizer and destroys it.  This method does not
cause any layout or resizing to take place, call `Layout` to update
the layout on screen after removing a child from the sizer.  The
*item* parameter can be either a window, a sizer, or the zero-based
index of an item to remove.  Returns True if the child item was found
and removed.

The wx.Sizer.Remove() overload that takes a window argument is deprecated. It’s recommended to use wx.Sizer.Detach() instead.

Thanks a lot.
Detach works.