在 kivy 中使用工厂对象

Using Factory objects in kivy

我刚刚在阅读 this page in the kivy docs about Factory objects. I was reading it in order to understand the example code given for the Filchooser in the kivy docs, here(最终,这就是我想要理解的)。但是,我真的不明白为什么要使用 Factory 对象。到目前为止,在我看来,它是用来实例化一个 class,就像一个或两个衬里而不是常规 class 定义。它实际上有什么作用,为什么要使用它?

我认为这个例子可能很老了,一般情况下你不需要担心工厂,小部件会自动注册,你不需要手动与之交互。

我不确定 Factory 的所有用途,但核心目的可能是跟踪用于 kv 语言的小部件 - 它们是通过 Factory 查找的。