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

2024-09-28 05:22:34 发布

您现在位置:Python中文网/ 问答频道 /正文

这段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

Tags: 函数selfgetinitemaildefcodesome

热门问题