from ui_rightCar import Ui_rightCar
class rightCar(QFrame, Ui_rightCar):
def __init__(self, parent=None):
super(rightCar, self).__init__(parent)
self.setupUi(self)
이 세상 간단함이 아니다.
*.ui 파일로 만든 ui_*.py 파일을 불러와 setup해주는 함수를 만든다.
2. layout 생성
self.ui.layoutMonitor = QGridLayout(self.ui.BoxMonitor)
self.ui.layoutMonitor.setSpacing(0) #각 객체 사이의 여백을 설정(Horizental, Vertical 따로 설정할 수 있는 함수도 있다)
self.ui.layoutMonitor.setAlignment(Qt.AlignBottom)
self.ui.layoutMonitor.setContentsMargins(0,0,0,0) #객체 하나하나의 여백을 설정
main.py에 layoutMonitor를 QGridLayout 객체를 만들고 그 parent를 BoxMonitor라는 GroupBox의 Layout으로 설정해준다.