import kivy
from kivy.app import App
from kivy.uix.label import Label
from kivy.uix.gridlayout import GridLayout
from kivy.uix.textinput import TextInput
class MyGrid(GridLayout):
def __init__(self, **kwargs):
super(MyGrid, self).__init__(**kwargs)
self.cols = 2
self.add_widget(Label(text="Name: "))
self.name = TextInput(multiline=False)
self.add_widget(self.name)
class MyApp(App):
def build(self):
return MyGrid
if __name__ == '__main__':
MyApp().run()
我目前正在观看关于 kivy 的 youtube 教程,但我不断收到此 app.root 错误,这是什么意思,我该如何解决?谢谢。