如何在PyQT UI中创建一个包含以下示例的布局的选项卡。
标签名称 - MNOP
布局有。
数据输入将存储在数据库中并用于创建条形图。现在我需要创建选项卡和文本框。
现在,我正在使用以下不完整但不知道如何继续。
class RPBDlg(QDialog):
def __init__(self, parent=None):
super(RPBDlg, self).__init__(parent)
self.newcounter =0
grid = QGridLayout()
label = QLabel()
label.setText("<B>Plan Title:</B>")
self.titleEdit = QLineEdit()
grid.addWidget(label,0,0,1,1)
grid.addWidget(self.titleEdit,0,1,1,1)
label2 = QLabel("<B>Type of Plan</B>")
self.typeEdit = QComboBox()
self.typeEdit.addItems(["STI","LTI","STI and LTI"])
grid.addWidget(label2,1,0,1,1)
grid.addWidget(self.typeEdit,1,1,1,1)
self.bonusPool = QCheckBox("Bonus Pool")
grid.addWidget(self.bonusPool,1,4,1,1)
label3 = QLabel("<B>Sub-Type of Plan<B>")
self.subTypeEdit = QComboBox()
self.subTypeEdit.addItems(["Regular","Profit Sharing","Multiplier Based"])
grid.addWidget(label3,1,2,1,1)
grid.addWidget(self.subTypeEdit,1,3,1,1)
self.label4 = QLabel("<B>Are individual awards determined <br>through a performance formula?")
self.bonusPoolAdditional = QComboBox()
self.bonusPoolAdditional.addItems(["Yes - separate formula for individual awards","Yes - individual awards are proportional to bonus pool", "No - individual awards are discretionary","No - individual awards determined through negative discretion"])
grid.addWidget(self.label4,3,0,1,1)
grid.addWidget(self.bonusPoolAdditional,3,1,1,2)
进口存在。此代码是更大代码的一部分。
答案 0 :(得分:1)
如果您想在UI中使用标签,则应创建QTabWidget
。使用它的基本步骤是:
QTabWidget
。您可以在小部件的documentation page中找到详细信息。