python - 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
解决方案
推荐阅读
- php - Plesk 更新后,PHP 7.1x MSSQL 连接失败并在 SQL_HANDLE_ENV 上出现 SQLAllocHandle
- javascript - Redux 操作使“on”套接字事件加倍
- php - Send MULTIPLE Attachments from Input on Form via PHPMailer
- java - How to split string but keep delimiters in java?
- c - 结构内的释放 char**
- c# - .net core data annotation display Name - inherite to viewmodels
- scala - Spark dataframe cast column for Kudu compatibility
- pentaho-data-integration - In Pentaho Data Integration can I output conditionally?
- excel - 如何使变量从单个单元格中获取多个值并将其用作自动过滤条件
- android - Jenkins:Gradle 构建:AAPT2 问题:AAPT2 aapt2-3.4.0-5326820-windows 守护进程 #0:守护进程启动失败