【发布时间】:2019-10-12 19:31:39
【问题描述】:
我正在做一个学校项目,使用 python 和 kivy。我对类和继承不是很熟悉。我在包含“pass”的python文件中创建了一个类。该类继承了 kivy 的属性(ListItemButton),然后我在 kivy 文件中使用此属性来创建“ListView”和其中的适配器。我的 kivy 应用程序运行良好,但可视化工作室代码向我显示错误“类 'Boom'pylint(duplicate-bases) 的重复基数”,我不知道为什么。
我尝试将类名从“ToDoListButton”更改为“Boom”。只是尝试,但没有成功。
"""this is python file"""
from kivy.uix.listview import ListItemButton
class Boom(ListItemButton):
pass
"""this is kivy file"""
#: import main thelist
#: import ListAdapter kivy.adapters.listadapter.ListAdapter
#: import ListItemButton kivy.uix.listview.ListItemButton
<TodoList> """this is another class for a window in the app"""
ListView:
id: thelist
adapter: ListAdapter(data=["study"], cls=main.Boom)
应用程序按预期运行,但 Visual Studio 代码中仍显示此错误“类 'Boom'pylint(duplicate-bases) 的重复基数”。
【问题讨论】: