﻿from PyQt5.QtGui import *  
from PyQt5.QtCore import *  
from PyQt5.QtWidgets import *
import sys  
  
  
class MainWidget(QMainWindow):  
    def __init__(self,parent=None):  
        super(MainWidget,self).__init__(parent)  
        font=QFont("黑体",12)  
        QApplication.setFont(font)  
  
        mainSplitter=QSplitter(Qt.Horizontal,self)  
        leftText=QTextEdit("左窗口",mainSplitter)  
        leftText.setAlignment(Qt.AlignCenter)  
        rightSplitter=QSplitter(Qt.Vertical,mainSplitter)  
        rightSplitter.setOpaqueResize(False)  
        upText=QTextEdit("上窗口",rightSplitter)  
        upText.setAlignment(Qt.AlignCenter)  
        bottomText=QTextEdit("下窗口",rightSplitter)  
        bottomText.setAlignment(Qt.AlignCenter)  
        mainSplitter.setStretchFactor(1,1)  
        mainSplitter.setWindowTitle("分割窗口")  
  
        self.setCentralWidget(mainSplitter)  
                   
app=QApplication(sys.argv)  
main=MainWidget()  
main.show()  
app.exec_()  