pyqt qlabel hide

发布时间 2023-11-12 16:33:54作者: 西北逍遥

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_()

 

 

 

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