PyQt5总结--index_windows

from PyQt5.QtWidgets import QWidget,QGroupBox,QVBoxLayout,QTableWidget,QTextEdit
#首页类
class index_window(QWidget):
    def __init__(self):
        super().__init__()
        #定义窗口组件
        self.index_tablewidget = QTableWidget(1,3)
        self.index_textedit = QTextEdit()

        self.initUI()

    def initUI(self):
        #窗口组件初始化
        self.index_tablewidget.setHorizontalHeaderLabels(['1','2','3'])
        self.index_textedit.setReadOnly(True)
        #QGroupbox布局
        table_groupbox = QGroupBox('站点情况预览')
        table_vbox = QVBoxLayout()
        table_vbox.addWidget(self.index_tablewidget)
        table_groupbox.setLayout(table_vbox)
        text_groupbox = QGroupBox('运行信息')
        text_vbox = QVBoxLayout()
        text_vbox.addWidget(self.index_textedit)
        text_groupbox.setLayout(text_vbox)
        #窗口布局
        vbox = QVBoxLayout()
        vbox.addWidget(table_groupbox)
        vbox.addWidget(text_groupbox)
        vbox.setStretchFactor(table_groupbox,7)
        vbox.setStretchFactor(text_groupbox,3)
        self.setLayout(vbox)

当前标题:PyQt5总结--index_windows
网页URL:http://scyanting.com/article/gicejp.html