kivy에서 BoxLayout을 배우려고 시도하는 동안 어설 션 오류가 발생했습니다. 나는 무엇이 잘못되었는지 알 수 없다. Python/Kivy 어설 션 오류
from kivy.app import App
from kivy.uix.button import Button
from kivy.uix.boxlayout import BoxLayout
class BoxLayoutApp(App):
def build(self):
return BoxLayout()
if __name__=="__main__":
BoxLayoutApp().run()
그리고 KV 코드
:<BoxLayout>:
BoxLayout:
Button:
text: "test"
Button:
text: "test"
Button:
text: "test"
BoxLayout:
Button:
text: "test"
Button:
text: "test"
Button:
text: "test"
편집 : 그러나 나는 아직도 AssertionError를 직면 제안 BoxLayout에서는 하위 클래스했습니다. 내가 여기에 재현 전체 (원본) 오류 메시지 대신
Traceback (most recent call last):
File "boxlayout.py", line 12, in <module>
BoxLayoutApp().run()
File "C:\Users\user\AppData\Local\Programs\Python\Python36-32\lib\site-packages\kivy\app.py", line 802, in run
root = self.build()
File "boxlayout.py", line 8, in build
return BoxLayout()
File "C:\Users\user\AppData\Local\Programs\Python\Python36-32\lib\site-packages\kivy\uix\boxlayout.py", line 131, in
__init__
super(BoxLayout, self).__init__(**kwargs)
File "C:\Users\user\AppData\Local\Programs\Python\Python36-32\lib\site-packages\kivy\uix\layout.py", line 76, in __in
it__
super(Layout, self).__init__(**kwargs)
File "C:\Users\user\AppData\Local\Programs\Python\Python36-32\lib\site-packages\kivy\uix\widget.py", line 345, in __i
nit__
Builder.apply(self, ignored_consts=self._kwargs_applied_init)
File "C:\Users\user\AppData\Local\Programs\Python\Python36-32\lib\site-packages\kivy\lang\builder.py", line 451, in a
pply
self._apply_rule(widget, rule, rule, ignored_consts=ignored_consts)
File "C:\Users\user\AppData\Local\Programs\Python\Python36-32\lib\site-packages\kivy\lang\builder.py", line 566, in _
apply_rule
self.apply(child)
File "C:\Users\user\AppData\Local\Programs\Python\Python36-32\lib\site-packages\kivy\lang\builder.py", line 451, in a
pply
self._apply_rule(widget, rule, rule, ignored_consts=ignored_consts)
File "C:\Users\user\AppData\Local\Programs\Python\Python36-32\lib\site-packages\kivy\lang\builder.py", line 464, in _
apply_rule
assert(rule not in self.rulectx)
AssertionError
실제 오류를 보여주는 데 도움이됩니다. – Keith