Cant't hide a window when window size maximized in pyqt

前端 未结 1 658
终归单人心
终归单人心 2021-01-07 15:08

i have two windows,i want to hide it after three seconds by using Qt timer,but its overlapping...its probably occurs when window size sets to \"showMaximized\"

         


        
1条回答
  •  抹茶落季
    2021-01-07 15:56

    You do not observe that w1 is closed because w2 is above w1, but if it is working, so you point out in the comments I understand that you want initially only visible w1 and after 3 seconds w2 is displayed and w1 is hidden, considering that the solution is the following:

    if __name__ == "__main__":
        import sys
        app = QtGui.QApplication(sys.argv)
        w1=Dialog()
        w2=Dialog1()
        w2.hide()
        QtCore.QTimer.singleShot(3000, w1.hide)
        QtCore.QTimer.singleShot(3000, w2.showMaximized)
        sys.exit(app.exec_())
    

    0 讨论(0)
提交回复
热议问题