我一直在查看一些关于PyQt4的教程,它很好,但我不太明白为什么创建对象时的语法是这样的:
class Example(QtGui.QMainWindow):
def __init__(self):
super(Example, self).__init__()
self.initUI()
def initUI(self):
#code to set up instance variables and show() the window
做到这一点,与完全消除self.initUI()调用并只将设置属性的任何代码放在super被调用后的__init__()中有什么确切的收益?
initUI
方法,或以不同的方式调用它。 - tripleee