def c_combobox(self, text, choices, confkey, restart=False, tip=None): label = QLabel(text) combobox = QComboBox() combobox.restart_required = restart combobox.label_text = text if tip: combobox.setToolTip(tip) for name, key in choices: if name and key: combobox.addItem(name, key) i = 0 for idx, item in enumerate(choices): name, key = item if not name and not key: combobox.insertSeparator(idx + i) i += 1 self.comboboxes[combobox] = confkey layout = make_layout(self, Qt.Horizontal, label, combobox) layout.addStretch(1) widget = QWidget(self) widget.label = label widget.combobox = combobox widget.setLayout(layout) return widget