[PyQt] Clear/delete widget in a Layout

starglider develop starglider.dev at gmail.com
Wed Aug 18 23:51:14 BST 2010


Hi,
thank you all of you for your help, I solve my problem with Matteo code.
Regards,

On 9 August 2010 10:00, Matteo Bertozzi <th30z at develer.com> wrote:

> On Sun, 2010-08-08 at 23:59 +0100, starglider develop wrote:
> > Hi,
> > I have a layout and need to remove all the widgets in the layout
> > to populate with other widget,
> > but didn't find a way of doing that.
> > Any ideas.
> >
>
> def clearLayout(layout):
>    while layout.count() > 0:
>        item = layout.takeAt(0)
>        if not item:
>            continue
>
>        w = item.widget()
>        if w:
>            w.deleteLater()
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20100818/9ffc67a4/attachment.html>


More information about the PyQt mailing list