...
from PyQt4.QtGui import *
from PyQt4.QtCore import *
class UserInfoModalWindow(QDialog):
def init(self):
super(UserInfoModalWindow, self).init()
self.dialog_window = QDialog(self)
...
self.dialog_window.exec_()
...
def quit(self):
self.dialog_window.close()
...
class AcceptDialogWindow(UserInfoModalWindow):
def init(self):
super(UserInfoModalWindow, self).init()
self.accept_dialog = QDialog()
...
self.accept_button = QPushButton()
self.cancel_button = QPushButton()
...
self.connect(self.accept_button,
SIGNAL('clicked()'),
lambda: self.quit())
self.connect(self.cancel_button,
SIGNAL('clicked()'),
self.accept_dialog.close)
...
self.accept_dialog.exec_()
...
# From this method I want to call a method from a parent class
def quit(self):
self.accept_dialog.close()
return super(UserInfoModalWindow, self).quit()
当点击“cancel_button”时 - 只有accept_dialog 关闭,这是正确的,但是当点击“accept_button”时——accept_dialog AND dialog_window 应该被关闭。
I get this error: File "app.py", line 252, in quit
return super(UserInfoModalWindow, self).quit()
AttributeError: 'super' object has no attribute 'quit'
问题是什么?我做错了什么?