救助:PyQt4 中如何设置窗口关联?
Level1 -> Level2 -> Level3
只要顶层的窗口关闭,它的子窗口也全部关闭
或者,如何能让子窗口在最顶层? 像Warning一样,不关掉无法操作其它窗口
[解决办法]
#coding: utf-8
from PyQt4.Qt import *
from PyQt4.QtCore import *
from PyQt4.QtGui import *
def main():
print "main"
if __name__ == "__main__":
import sys
app = QApplication(sys.argv)
print type(Qt.WindowModal)
widget1 = QWidget()
widget1.resize(600,400)
widget1.setStyleSheet(QString.fromUtf8("background:black"))
widget2 = QWidget(widget1,Qt.Window)
widget2.setWindowModality(Qt.ApplicationModal)
widget2.resize(400,200)
widget2.setStyleSheet(QString.fromUtf8("background:red"))
widget3 = QWidget(widget2,Qt.Window)
widget3.setWindowModality(Qt.ApplicationModal)
widget3.setStyleSheet(QString.fromUtf8("background:white"))
widget3.resize(300,100)
widget1.show()
widget2.show()
widget3.show()
app.exec_()
满意记得结贴啊