1.

How Do I Remove A Component, Or All Components Of A Certain Type From A Wxframe/wxpanel?

Answer»

If your CONTAINER is using a SIZER, you can remove all its children with this function:

Toggle line numbers 

  1. def removeChildren(self, destroy=1):
  2. """
  3. Remove all my children components and optionally
  4. destroy them.
  5. """
  6. while self.GetSizer().Remove(0):
  7.  pass
  8. if destroy:
  9. self.DestroyChildren() 

To only remove children of a particular kind (ie.wxStaticText), you COULD add a parameter to the method, and do an ISINSTANCE() test.

If your container is using a sizer, you can remove all its children with this function:

Toggle line numbers 

To only remove children of a particular kind (ie.wxStaticText), you could add a parameter to the method, and do an isinstance() test.



Discussion

No Comment Found