Re: Close window ( Doubt )
Reimplement the main window closeEvent() and close it explicitly.... at least you could if your code was taking a traditional approach to subclassing QMainWindow.
Re: Close window ( Doubt )
Solved.
The function closeEvent() is inappropriate for this case.
I just created a kinship between the windows to make this possible. The closeEvent () now comes as a complement.
Code:
#!/usr/bin/env python
#-*- coding: utf-8 -*-
import sys
from PyQt4.QtGui import *
from PyQt4.QtCore import *
def __init__(self,parent=None): # Parentesco
super(popup,self).__init__(parent)
self.setWindowTitle("Janela Popup")
self.setMinimumSize(400 , 400)
def __init__(self, parent=None):
super(Mainw, self).__init__(parent)
self.setMinimumSize(400 , 400)
self.setWindowTitle("Janela Principal")
self.
btn1.
setGeometry(QRect(100,
50,
200,
200))
QObject.
connect(self.
btn1,
SIGNAL("clicked()"), self.
openpopup)
def openpopup(self):
pop = popup(self)
pop.show()
if __name__ == "__main__":
main = Mainw()
main.show()
sys.exit(app.exec_())