QGroupBox with two rows of widgets

Maurizio Berti maurizio.berti at gmail.com
Mon May 3 19:00:23 BST 2021


Il giorno lun 3 mag 2021 alle ore 19:02 Rich Shepard <
rshepard at appl-ecosys.com> ha scritto:

> > - change all tb1.layout().addWidget(...) to tb1.addWidget(...);
> > - you can access the layout set on a widget by using widget.layout(), but
> > since you're creating it in the same scope, there's no need for that:
> just
> > create it with a reference and use that afterwards: tboxLayout =
> > qtw.QVBoxLayout(tbox);
> > - add the child layout correctly: tboxLayout..addLayout(tb1);
> > - set the *main* layout for your widget, otherwise you'll certainly face
> > some issues:
> >        mainLayout = qtw.QVBoxLayout(self)
> >        mainLayout.addWidget(tbox)
>
> Maurizio,
>
> Still the same error:
> $ python biomwe.py
> Traceback (most recent call last):
>    File "biomwe.py", line 92, in <module>
>      bio = BiotaWindow()
>    File "biomwe.py", line 72, in __init__
>      tbox.addLayout(tb1)
> AttributeError: 'QGroupBox' object has no attribute 'addLayout'
>

Please, read more carefully.
I used "tboxLayout", not "tbox":

tboxLayout..addLayout(tb1)

That tboxLayout refers to the previous point in my list, in which I created
that object as the layout to which you add the other child layouts.

Maurizio

-- 
È difficile avere una convinzione precisa quando si parla delle ragioni del
cuore. - "Sostiene Pereira", Antonio Tabucchi
http://www.jidesk.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20210503/b5cd6379/attachment-0001.htm>


More information about the PyQt mailing list