pyqt5窗体分隔

import sys
from PyQt5.QtWidgets import (QApplication, QWidget, QHBoxLayout,
QFrame, QSplitter)
from PyQt5.QtCore import Qt


class Example(QWidget):

def __init__(self):
super().__init__()

hbox = QHBoxLayout(self)

topleft = QFrame(self)
topleft.setFrameShape(QFrame.StyledPanel) # 设置边框

topright = QFrame(self)
topright.setFrameShape(QFrame.StyledPanel) # 设置边框



splitter1 = QSplitter(Qt.Horizontal)
splitter1.addWidget(topleft)
splitter1.setSizes([100, ]) # 设置分隔条位置
splitter1.addWidget(topright)


hbox.addWidget(splitter1)
self.setLayout(hbox)

self.setGeometry(600, 600, 600, 600)
self.setWindowTitle('窗口分隔')
self.show()


if __name__ == '__main__':
app = QApplication(sys.argv)
ex = Example()
sys.exit(app.exec_())
上一篇:leetcode刷题----600. 不含连续1的非负整数


下一篇:成都Uber优步司机奖励政策(4月23日)