我想继承 widget1 以使用它的方法,但我得到:
"TypeError: Error when calling the metaclass bases Cannot create a
consistent method resolution order (MRO) for bases widget1, QWidget"
当我运行程序时。你能向我解释为什么会这样吗?
感谢。
from PyQt4.QtGui import *
from PyQt4.QtCore import *
from PyQt4 import QtCore, QtGui
import sys
class widget1(QtGui.QWidget):
def __init__(self):
QtGui.QWidget.__init__(self)
class widget2(QtGui.QWidget, widget1):
def __init__(self):
QtGui.QWidget.__init__(self)
if __name__ == '__main__':
app = QtGui.QApplication(sys.argv)
test = widget1()
test.show()
sys.exit(app.exec_())