def init_widget(self):
self.setWindowTitle("Layout Basic")
self.setFixedWidth(640)
self.setFixedHeight(480)
self.lb_1.setText("Label 1")
self.lb_2.setText("Label 2")
self.lb_3.setText("Label 3")
self.lb_4.setText("Label 4")
self.lb_5.setText("Label 5")
self.lb_1.setStyleSheet("background-color: yellow")
self.lb_2.setStyleSheet("background-color: red")
self.lb_3.setStyleSheet("background-color: blue")
self.lb_4.setStyleSheet("background-color: pink")
self.lb_5.setStyleSheet("background-color: grey")
self.layout_1.addWidget(self.lb_1)
self.layout_1.addWidget(self.lb_2, alignment=Qt.AlignTop)
self.layout_1.addWidget(self.lb_3, alignment=Qt.AlignBottom)
self.layout_1.addWidget(self.lb_4, alignment=Qt.AlignVCenter)
self.layout_1.addWidget(self.lb_5, alignment=Qt.AlignHCenter)
评论列表
文章目录