1. QSplitter : 프레임을 분할하여 각 영역의 크기를 조절 할 수 있음

import sys

from PyQt5.QtWidgets import QWidget
from PyQt5.QtWidgets import QSplitter
from PyQt5.QtWidgets import QTextEdit
from PyQt5.QtWidgets import QVBoxLayout
from PyQt5.QtWidgets import QApplication
from PyQt5.QtCore import Qt

class Form(QWidget):
    def __init__(self):
        QWidget.__init__(self, flags=Qt.Widget)
	    self.text_1 = QTextEdit()
    self.text_2 = QTextEdit()
    self.text_3 = QTextEdit()
    self.split_1 = QSplitter()
    self.split_2 = QSplitter()
	
	    self.vbox = QVBoxLayout()
    self.container_vbox = QVBoxLayout()
    self.init_widget()
	
	def init_widget(self):
    self.setWindowTitle("Splitter")
    self.split_1.addWidget(self.text_1)
    self.split_1.addWidget(self.text_2)
	    self.container_vbox.addWidget(self.split_1)
	
	    self.split_2.setOrientation(Qt.Vertical)
    self.split_2.addWidget(self.split_1)
    self.split_2.addWidget(self.text_3)
        self.vbox.addWidget(self.split_2)
        self.setLayout(self.vbox)

if __name__ == "__main__":
    app = QApplication(sys.argv)
    form = Form()
    form.show()
    exit(app.exec_())

 

 

반응형

'Tech & Development > Programming Languages' 카테고리의 다른 글

Jupyter Notebook 단축키  (0) 2021.01.29
Jupyter Notebook 기본 사용법  (0) 2021.01.29
Jupyter Notebook 설치 및 실행 (Windows 10)  (0) 2021.01.29
[ PyQt ] Layout Widget  (0) 2021.01.29
PyQt 설치 및 실행  (0) 2021.01.29