QGroupBox with two rows of widgets

Tomas Sobota tom at sobota.net
Mon May 3 17:07:37 BST 2021


Rich, as a general suggestion for your learning, why don't you build your
GUI interactively with Qt Designer? That way you can look at the Python
code that is generated by pyuic. It's very handy
Tom

On Mon, May 3, 2021 at 5:22 PM Rich Shepard <rshepard at appl-ecosys.com>
wrote:

> Running Slackware64-14.2, Python-3.7.2, PyQt-5.13.2.
>
> QGroupBox is a container holding layouts with widgets. I want to group six
> widgets -- in two rows -- into a groupbox. Having each row of widgets
> in a group with the same title was successful, but I'm failing at having
> both rows of widgets in a single group box.
>
> A minimal working example is attached.
>
> The problem is in lines 72 (and the following line):
>
> $ 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'
>
> and
>
> $ 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.addWidget(tb1)
> AttributeError: 'QGroupBox' object has no attribute 'addWidget'
>
> I've not found an example of what I'm trying to do in Alan Moore's book or
> in my web searches. The latter have examples of single widgets in a
> QVBoxLayout, but not multiple widgets in each row.
>
> Looking forward to learning how to do this.
>
> TIA,
>
> Rich
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20210503/6975cf22/attachment.htm>


More information about the PyQt mailing list