[PyQt] Completely removing items from a layout

Lee Harr missive at hotmail.com
Sat Nov 28 18:30:35 GMT 2009


> you need to delete both the layouts and their contents:
>
>    def unfill(self):
>        def deleteItems(layout):
>            if layout is not None:
>                while layout.count():
>                    item = layout.takeAt(0)
>                    widget = item.widget()
>                    if widget is not None:
>                        widget.deleteLater()
>                    else:
>                        deleteItems(item.layout())
>        deleteItems(self.ui.verticalLayout)


Brilliant. Thanks!

 		 	   		  
_________________________________________________________________
Keep your friends updated—even when you’re not signed in.
http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_5:092010


More information about the PyQt mailing list