def getWidget(): widget = QWidget() widget.setObjectName('load_image') # should be plugin name widget.isSource = True widget.inputImg = None widget.outputImg = None widget.needsGraphicsView = False # declare all parameter widgets below vbox1 = QVBoxLayout() widget.chkGrayScale = QCheckBox('Gray Scale') # ~ chkGrayScale.setObjectName('chkGrayScale') hbox1 = QHBoxLayout() lblSource = QLabel('Image Source') bgrpSource = QButtonGroup(widget) # need to provide parent (widget) or the button group is orphaned and won't work properly widget.optFile = QRadioButton('File', widget) widget.optFile.setObjectName('optFile') widget.optCamera = QRadioButton('Camera') widget.optCamera.setObjectName('optCamera') bgrpSource.addButton(widget.optFile, 1) bgrpSource.addButton(widget.optCamera, 2) bgrpSource.buttonClicked.connect(lambda: radiohandler(widget)) # ~ bgrpSource.buttonClicked.connect(shambo) hbox1.addWidget(lblSource) hbox1.addWidget(widget.optFile) hbox1.addWidget(widget.optCamera) hbox2 = QHBoxLayout() lblFile = QLabel('File:') widget.txtFile = QLineEdit() widget.txtFile.setObjectName('txtFile') btnBrowseFile = QPushButton('Browse...') btnBrowseFile.clicked.connect(lambda: on_btnBrowseFile_clicked(widget)) hbox2.addWidget(lblFile) hbox2.addWidget(widget.txtFile) hbox2.addWidget(btnBrowseFile) vbox1.addWidget(widget.chkGrayScale) vbox1.addLayout(hbox1) vbox1.addLayout(hbox2) widget.setLayout(vbox1) # ~ widget.img = None for item in widget.findChildren(QWidget): item.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred) widget.optCamera.setChecked(True) return widget