pyqt弹出新对话框,以及关闭对话框获取数据

from PyQt4 import QtGui,QtCore
import sys
class Web_Browser(QtGui.QDialog):
    def __init__(self,parent=None):
        QtGui.QWidget.__init__(self)
        self.resize(550,400)
        open=QtGui.QPushButton('OPEN')
        self.connect(open,QtCore.SIGNAL('clicked()'),self.ok)
        grid=QtGui.QGridLayout()
        grid.addWidget(open,1,0,1,1)
        self.setLayout(grid)
        self.setWindowTitle('main windows')    
    def ok(self):
        web=Web_Browser()
        web.setModal(False)
        web.setWindowTitle('sub window')
        web.exec_()

app=QtGui.QApplication(sys.argv)

app.setFont(QtGui.QFont("Helvetica", 16))
main=Web_Browser()
main.show()

sys.exit(app.exec_())
 
 
 

你可能感兴趣的:(pyqt弹出新对话框,以及关闭对话框获取数据)