pyqt qlabel hide

pyqt  qlabel  hide

 

from PyQt5.QtWidgets import QApplication, QWidget, QVBoxLayout, QLabel
class MyApp(QWidget):
    def __init__(self):
        super().__init__()
        self.initUI()
    def initUI(self):
        self.layout = QVBoxLayout()
        self.setLayout(self.layout)
        # 创建一个QLabel并添加到布局中
        self.label = QLabel("Hello World!")
        self.layout.addWidget(self.label)
        # 隐藏QLabel
        self.label.hide()
if __name__ == '__main__':
    app = QApplication([])
    ex = MyApp()
    ex.show()
    app.exec_()

 

 

 

##############

posted @ 2023-11-12 16:29  西北逍遥  阅读(28)  评论(0编辑  收藏  举报