I am trying to add a QPushButton widget into a QGroupBox such as:
self.btn = QtGui.QPushButton('Push Button')
self.grp_box = QtGui.QGroupBox('Button Section')
self.grp_box.addWidget(self.btn)
When trying to run the code, I got this error : AttributeError: 'NoneType' object has no attribute 'addWidget'
After some online checking, it seems that QGroupBox only allows setLayout
, meaning I will need to use QVBoxLayout
or QHBoxLayout
etc.
Is there anyway to get around this, adding in a widget without the use of any layout(s)? I am using PyQt.