2016-11-20 2 views
0

Ich entwickle Android App mit Python und Kivy Ich benutze Boxlayout und versuchen, Layout mit String laden, aber es nicht laden und mir diesen Fehler und ein schwarzes Fenster öffnen, wenn ich ausgeführt werde dieser Code i verstehe mich nicht, was das Problem ist jetzt ich diese Störung erhalten bitte dieses ProblemIch bekomme einen Fehler in Kivy Python

from kivy.app import App 
from kivy.uix.boxlayout import BoxLayout 
from kivy.lang import Builder 
from kivy.uix.label import Label 



Builder.load_string(''' 
<Layout>: 
    Lebel: 
     text: "Hello World" 
''') 


class Layout(BoxLayout): 
     pass 

class MyApp(App): 
    def build(self): 
     return Layout() 

MyApp().run() 

und das ist Fehler

Traceback (most recent call last): 
    File "/root/Desktop/MyApp/main.py", line 25, in <module> 
    MyApp().run() 
    File "/usr/lib/python2.7/dist-packages/kivy/app.py", line 802, in run 
    root = self.build() 
    File "/root/Desktop/MyApp/main.py", line 23, in build 
    return Layout() 
    File "/usr/lib/python2.7/dist-packages/kivy/uix/boxlayout.py", line 102, in __init__ 
    super(BoxLayout, self).__init__(**kwargs) 
    File "/usr/lib/python2.7/dist-packages/kivy/uix/layout.py", line 72, in __init__ 
    super(Layout, self).__init__(**kwargs) 
    File "/usr/lib/python2.7/dist-packages/kivy/uix/widget.py", line 320, in __init__ 
    Builder.apply(self, ignored_consts=self._kwargs_applied_init) 
    File "/usr/lib/python2.7/dist-packages/kivy/lang.py", line 1970, in apply 
    self._apply_rule(widget, rule, rule, ignored_consts=ignored_consts) 
    File "/usr/lib/python2.7/dist-packages/kivy/lang.py", line 2044, in _apply_rule 
    cls = Factory_get(cname) 
    File "/usr/lib/python2.7/dist-packages/kivy/factory.py", line 131, in __getattr__ 
    raise FactoryException('Unknown class <%s>' % name) 
kivy.factory.FactoryException: Unknown class <Lebel> 
[Finished in 0.6s with exit code 1] 
[shell_cmd: python -u "/root/Desktop/MyApp/main.py"] 
[dir: /root/Desktop/MyApp] 
[path: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin] 

Antwort

2

ki zu lösen helfen vy.factory.FactoryException: Unbekannte Klasse

Sie falsch geschrieben Label.