QLayout_01_Basic.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:OpenTutorials_PyQt 作者: RavenKyu 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号