构建kivy时调用的class参数
Parameter of the class invoked in building kivy
我是 kivy 新手。
我最近制作了第一个简单的应用程序。从各种在线文档中,我注意到有一个命令总是根据开发人员的解释而变化。我举一个简单的例子:
class ShowApp(thisParameterWillCompletelyChangeYourLife):
def __init__(self, **kwargs):
super(ShowApp, self).__init__(**kwargs)
def listenerOfAButton(self):
print("Reconized...")
def listenerOfAnotherButton(self):
print("Reconized it also...")
class myApp(App):
def build(self):
return ShowApp()
if __name__ == "__main__":
myApp().run()
kv 示例文件:
<ShowApp>:
Label:
id: labelIdentifier
text: "Hello World"
我想知道...尽管 ShowApp class 的名称必须等于 kv 文件中的 <ShowApp>
,这必须将参数传递给负责生成 kv 文件中包含的所有布局的 class?
在我的示例中,我将其称为thisParameterWillCompletelyChangeYourLife,正是关于此输入,我不理解到目前为止阅读的关于 kivy 的文档的意愿。
有人可以向我解释应该将什么参数(以及它的用途)传递给在构建阶段生成 'app' 的函数吗?
非常感谢!
您所说的 thisParameterWillCompletelyChangeYourLife
是 ShowApp
class 的基础 class。它不是要传入的参数。它可以是任何 class 或什么都不是。在您的使用中,它可能是 Widget
或者 Layout
class。正如所写,您的 ShowApp
正在尝试扩展名为 thisParameterWillCompletelyChangeYourLife
的 class。
看到这个 documentation
我是 kivy 新手。
我最近制作了第一个简单的应用程序。从各种在线文档中,我注意到有一个命令总是根据开发人员的解释而变化。我举一个简单的例子:
class ShowApp(thisParameterWillCompletelyChangeYourLife):
def __init__(self, **kwargs):
super(ShowApp, self).__init__(**kwargs)
def listenerOfAButton(self):
print("Reconized...")
def listenerOfAnotherButton(self):
print("Reconized it also...")
class myApp(App):
def build(self):
return ShowApp()
if __name__ == "__main__":
myApp().run()
kv 示例文件:
<ShowApp>:
Label:
id: labelIdentifier
text: "Hello World"
我想知道...尽管 ShowApp class 的名称必须等于 kv 文件中的 <ShowApp>
,这必须将参数传递给负责生成 kv 文件中包含的所有布局的 class?
在我的示例中,我将其称为thisParameterWillCompletelyChangeYourLife,正是关于此输入,我不理解到目前为止阅读的关于 kivy 的文档的意愿。
有人可以向我解释应该将什么参数(以及它的用途)传递给在构建阶段生成 'app' 的函数吗?
非常感谢!
您所说的 thisParameterWillCompletelyChangeYourLife
是 ShowApp
class 的基础 class。它不是要传入的参数。它可以是任何 class 或什么都不是。在您的使用中,它可能是 Widget
或者 Layout
class。正如所写,您的 ShowApp
正在尝试扩展名为 thisParameterWillCompletelyChangeYourLife
的 class。
看到这个 documentation