Kivy(框架):'me' 对象没有属性 'built'

Kivy (framework):'me' object has no attribute 'built'

当我尝试 运行 我的代码 python 给了我这个错误:

\kivy\app.py", line 916, in _run_prepare if not self.built: AttributeError: 'me' object has no attribute 'built'

import kivy
from kivy.app import App
from kivy.uix.button import Button 
from kivy.uix.gridlayout import GridLayout  
from kivy.uix.label import Label
from kivy.uix.textinput import TextInput


class me(App):
     def __init__(self,b,g,l,t):
          self.b=Button(text='start')
          self.g=GridLayout(cols=4)
          self.l=Label(text='label')
          self.t=TextInput()
          self.g.add_widget(self.b)
          self.g.add_widget(self.t)
          self.g.add_widget(self.l)


m=me('b','g','l','t')
m.run()

这段代码有什么问题?

当你over-ride一个超级class的方法(就像你的情况下的__init__()),你必须调用超级[=19]的over-ridden方法=].只需添加行:

super(me, self).__init__()

你的 __init__() 方法。