AddCategoryPopup
클래스에서 SAVE 버튼을 누를 때 TreeCategory
클래스에서 add_category_to_tree()
클래스를 호출하려고합니다. 그러나, 나는 KV 파일에서 생성 된 TreeCategory 인스턴스를 참조하는 방법에 문제가있다. 솔루션을 검색하려고했지만 아무 것도 작동하지 않았습니다. 현재 AttributeError: 'super' object has no attribute '__getattr__'
오류가 발생합니다.KV 파일로 생성 된 인스턴스를 참조하는 방법
어떻게해야합니까? 당신은 그것을 꽤 몇 가지 방법을 수행 할 수 있습니다
<AddCategoryPopup>:
BoxLayout:
orientation: 'vertical'
TextInput:
id: entry
multiline: False
hint_text: 'Podaj nazwę kategorii...'
BoxLayout:
orientation: 'horizontal'
Button:
text: 'SAVE'
on_press: root.save()
Button:
text: 'CANCEL'
on_press: root.close()
<MainScreen>:
orientation: "vertical"
display: entry
tree: tree
BoxLayout:
id: menu
size_hint_y: .1
Button:
text: 'Dodaj kategorię'
on_press: root.add_category_button()
BoxLayout:
id: recipe_view
orientation: "horizontal"
TreeCategory:
id: tree
hide_root: True
size_hint: .25, 1
이 설명에 감사드립니다. 이제 어떻게 작동하는지 이해합니다. – r3nia
환영합니다, 수락을 클릭하십시오 대답. – TomKivy