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_())

相关文章:

  • 2022-12-23
  • 2021-12-13
  • 2022-12-23
  • 2021-07-24
  • 2022-02-19
  • 2022-12-23
  • 2021-08-24
猜你喜欢
  • 2022-12-23
  • 2022-02-13
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-21
  • 2021-05-05
相关资源
相似解决方案