I'm working on a PyQt application.  Currently, there's a status panel (defined as a QWidget) which contains a QHBoxLayout.  This layout is frequently updated with QPushButtons created  by another portion of the application.
Whenever the buttons which appear need to change (which is rather frequently) an update effect gets called.  The existing buttons are deleted from the layout (by calling layout.removeWidget(button) and then button.setParent(None)) and the new buttons are added to the layout.
Generally, this works.  But occasionally, when I call button.setParent(None) on the button to delete, it causes it to pop out of the application and start floating in its own stand-alone frame.
How can I remove a button from the layout and ensure it doesn't start floating?
Try calling QWidget::hide() on the button before removing from the layout if you don't want to delete your button.
How do I prevent Qt buttons from appearing in a separate frame?