首页 > 解决方案 > TypeError:调用元类基时出错无法为基 FloatLayout、ConnectPage 创建一致的方法解析顺序 (MRO)

问题描述

此 Python-Kivy 代码使用多重继承。我收到上述错误。我希望我的 InfoPage 类继承所有 FloatLayout 函数和初始化,并且我希望它从 ConnectPage 类继承 get_email 函数。我该如何解决这个问题?

class ConnectPage(FloatLayout):
    def __init__(self, **kwargs):
        super(ConnectPage, self).__init__(**kwargs)
        ----some code ----

    def get_email(self):
        return email

class InfoPage(FloatLayout, ConnectPage):
    def __init__(self, **kwargs):
        super(InfoPage, self).__init__(**kwargs)

        ---- some code ----

    def get_peers(self):
        peers = db.common_choices(self.get_email())
        return peers

标签: pythonpython-2.7inheritancekivymultiple-inheritance

解决方案


推荐阅读