为什么我不能在 Kivy-App 中将标签放入 StackLayout(或其他布局)?

Why can't I seem to put a Label into a StackLayout (or other Layouts) within a Kivy-App?

理论上,放置 Kivy-Label into a Stack Layout(或其他布局)应该是最简单和最常见的事情 - 但它目前让我陷入绝望。以下语法显示一个普通的单按钮应用程序(在 Kivy 1.8 或 1.9,Win 7 下)直到我取消注释标签生成行,它始终失败并显示诸如 AttributeError: 'LabelPygame' object has no attribute 'bind'AttributeError: 'LabelSDL2' object has no attribute 'bind'(在 layout.py 中):

from kivy.app import App
from kivy.uix.button import Button
from kivy.core.text import Label
from kivy.uix.stacklayout import StackLayout

class TestApp(App):
    def build(self):
        mylayout = StackLayout(orientation='lr-tb')
        mylayout.add_widget(Button(text='This button can always be rendered.'))
        # mylayout.add_widget(Label(text='This label seems to cause trouble.'))
        return mylayout

TestApp().run()

我有一种预感,我忽略了一些非常非常明显或愚蠢的东西,但无法理解它是什么。基于 BuilderrunTouchApp 的替代调用似乎工作得很好(布局的种类似乎没有什么区别):

# ... other imports abbreviated ... 

Builder.load_string('''
<MyLayout>:
    Button:
        text: "This button can always be rendered."
    Label:
        text: "This label works in this case."
''')

class MyLayout(FloatLayout):
    pass

runTouchApp(MyLayout())

您正在导入 kivy.core.text.Label,但您确实想要 kivy.uix.label.Label