# -*- coding: utf8 -*-
from kivy.uix.accordion import Accordion, AccordionItem
from kivy.uix.label import Label
from kivy.app import App
from kivy.uix.button import Button
items = {
"razdely": [
{"text": "О жизни", "id": 1},
{"text": "О Человеке", "id": 2},
{"text": "О тесте", "id": 3}]
}
class AccordionApp(App):
def build(self):
root = Accordion(orientation='vertical')
for x in items.get('razdely'):
item = AccordionItem(title=x.get("text"))
item.add_widget(Button(text="Кнопка N1"))
item.add_widget(Button(text="Кнопка N2"))
root.add_widget(item)
return root
if __name__ == '__main__':
AccordionApp().run()
layout = BoxLayout(orientation='vertical')
btn1 = Button(text='Hello')
btn2 = Button(text='World')
layout.add_widget(btn1)
layout.add_widget(btn2)
for x in items.get('razdely'):
item = AccordionItem(title=x.get("text"))
#~ item.add_widget(Button(text="Кнопка N1"))
#~ item.add_widget(Button(text="Кнопка N2"))
#~ item.add_widget(layout)
layout = BoxLayout(orientation='vertical')
btn1 = Button(text='Hello')
btn2 = Button(text='World')
layout.add_widget(btn1)
layout.add_widget(btn2)
item.add_widget(layout)
root.add_widget(item)